2
private void sendSMS(String phoneNumber, String message)
{
PendingIntent pi = PendingIntent.getActivity(this, 0,
new Intent(this, MainActivity.class), 0);
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, pi, null);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String msg = "some text";
sendSMS("xxxxxxxxx", msg);
}
我有類似上面的代碼。問題是,當我運行應用程序時,它會發送一個接一個的消息。如何讓它發送一個和唯一一個短信?短信管理器發送多個短信