0

I am writing a backup and restore demo. And it work well in Android 4. But it failed to restore sms in Android 6.0.

I request sms permission by code already. But I can't insert sms by Resolver. Here is my code.

// if the sms not exist, insert it
if (cursor.getCount() == 0) {
        context.getContentResolver().insert(
                Uri.parse(CONTENT_SMS), values);
}

private static final String CONTENT_SMS = "content://sms";

It haven't throw any exception when insert sms.

ittianyu
  • 509
  • 4
  • 7
  • Basically, since 4.4, your app must be selected as the user's default messaging app to be able to save messages. To configure your app to be eligible to be selected as such, refer to the following blog post: [Getting Your SMS Apps Ready for KitKat](http://android-developers.blogspot.com/2013/10/getting-your-sms-apps-ready-for-kitkat.html?m=1). That page recommends that SMS backup apps are setup to allow the user to temporarily set them as the default while performing a restore. [This post](http://stackoverflow.com/a/30133663) might also be of some help. – Mike M. Oct 22 '16 at 07:15
  • 1
    Thank for your help. – ittianyu Oct 22 '16 at 07:26

0 Answers0