sendTextMessage In android phone

后端 未结 4 2032
温柔的废话
温柔的废话 2020-12-06 23:40

This is simple code send SMS.

47: SmsManager sms = SmsManager.getDefault();
48: sms.sendTextMessage(\"12345678901\", null, \"hello!\", null, null);
         


        
4条回答
  •  半阙折子戏
    2020-12-07 00:13

    give the pending intent in your 48th line as given bellow

    String sent = "android.telephony.SmsManager.STATUS_ON_ICC_SENT";
    PendingIntent piSent = PendingIntent.getBroadcast(smsActivity.this, 0,new Intent(sent), 0);
    
    sms.sendTextMessage("12345678901", null, "hello!", piSent, null);
    

    am sure it works :)

提交回复
热议问题