• 5,729,238
    REGISTERED
  • 41,703
    ONLINE NOW

Write to SMS Content Provider in KitKat without Being Default SMS App

Write to SMS Content Provider in KitKat without Being Default SMS App

Alongside the various user-facing and security-related changes introduced Android 4.4 KitKat, Google also significantly modified how the SMS Content Provider works. In Android 4.4, users can now select a default SMS app from within Settings -> Wireless & Networks. Then, two intent broadcasts are sent: one for all SMS apps (SMS_RECEIVED_ACTION) and one for only the default SMS app (SMS_DELIVER_ACTION). Thus, non-default SMS apps are able to receive incoming SMS messages, but they are not able to do certain things such as abort the broadcast.

Despite the positive effect on software modularity afforded by being able to select a default SMS app, the change also brings a few limitations. Namely, in order to delete (or restore) an SMS message, your app must temporarily become the default app if it isn’t already. This is problematic from a UX standpoint because there will be two mandatory prompts, where the user must select the default SMS app: one to select your app and one to revert.

Thankfully, XDA Senior Member stepic came up with a workaround that allows app developers to write to the SMS Content Provider in KitKat without being the default SMS app. Stepic made his discovery by looking in the Android source code and finding a special permission: OP_WRITE_SMS. Unfortunately, this workaround either requires user interaction or root access. However, this is only a one-time affair, rather than two prompts for user input every time a non-default SMS app needs to perform certain tasks.

If you’re an app developer looking to make an SMS app for KitKat, head over to the guide thread to learn more about this workaround.

_________
Join us for xda:devcon 2014. For a limited time, XDA Portal readers get 20% off registration!
Advertisment
Advertisement

XDA TV: Most Recent Video

Buy/Sell on Swappa

  • Nexus 5 (Unlocked) buy | sell
  • Galaxy Note 3 (T-Mobile) buy | sell
  • HTC One M7 (Verizon) buy | sell
  • Galaxy S 5 (Unlocked) buy | sell
  • Nexus 7 2013 buy | sell
  • Swappa is the official marketplace of XDA