2016-12-21 40 views
-1

有沒有辦法發送短信而不需要確認?我目前的代碼是:有沒有得到確認發送短信的任何方式?

String phoneNumber = "1234567"; 
     Intent intent = new Intent(Intent.ACTION_SENDTO); 
     intent.setData(Uri.parse("smsto:" + phoneNumber)); // This ensures only SMS apps respond 
     intent.putExtra("sms_body", "TESTING TEXT MESSAGE! IT WORKS!"); 
     if (intent.resolveActivity(getPackageManager()) != null) { 
      startActivity(intent); 
     } 
+1

你是什麼意思與「確認」? – dumazy

+0

你有沒有試過這個鏈接:http://stackoverflow.com/questions/26311243/sending-sms-programmatically-without-opening-message-app –

回答

0

是的,你應該使用SmsManager。這裏是一個例子:

SmsManager smsManager = SmsManager.getDefault(); 
smsManager.sendTextMessage("phoneNo", null, "sms message", null, null); 
相關問題