tags:

views:

60

answers:

1

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/conversations/"+threadId

Currently I'm using SMSManager:

SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phone, null, message, null, null);  

Is there any ways to do this across all the devices considering each of them has a different SMS app. Thanks in advance.

+1  A: 

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);
Ngo Minh Nam