How to save SMS to inbox in android?

Standard

You can use the SMS content provider to read and write SMS messages:

ContentValues values = new ContentValues();
values.put("address", "123456789");
values.put("body", "This is a test message!");
getContentResolver().insert(Uri.parse("content://sms/inbox"), values);

also add these in manifest:

<uses-permission android:name="android.permission.READ_SMS"/>
<uses-permission android:name="android.permission.WRITE_SMS"/>

4 thoughts on “How to save SMS to inbox in android?

    • Mohsen Mirhoseini Argi

      All dual sim Android devices has their own SDK that manufacturer gave it to developers and you have to take a look at it.
      But usually dual sim devices functionality is the same as single sim and just some changes made in calling and sending messages.

    • Dear Dheeraj, this post is too old! those days with older Android versions, application can access messages inbox, but now your application have to be one of the system apps. Accessing Messages is a system permission and you have to move your app to system folder if you have root access to the device os.

Leave a Reply

Your email address will not be published. Required fields are marked *