Android send SMS which is visible in SMS thread (no GUI)

前端 未结 2 1133
醉梦人生
醉梦人生 2020-12-13 22:31

What I need:
- Send SMS with no GUI interaction (choosing a client to send SMS is out)
- SMS has to be visible in a thread queried from \"content://mms-sms/conversat

相关标签:
2条回答
  • 2020-12-13 22:52

    Just figured it out, you can use ContentResolver to insert the SMS and remember to add permissions: "uses-permission android:name="android.permission.WRITE_SMS"

       ContentValues values = new ContentValues();
       values.put("address", phone);
       values.put("body", message);
       getContentResolver().insert(Uri.parse("content://sms/sent"), values);
    
    0 讨论(0)
  • 2020-12-13 23:16

    You need to use the following value:

    values.put("thread_id", threadId);
    

    And it will be associated with the thread.

    0 讨论(0)
提交回复
热议问题