Android Default SMS App permissions kitkat

803 views Asked by At

After going through lots of codes provided over the internet, I am still unable to list my SMS app in default Android kitkat version. I don't know whether it can be done by adding permissions to the manifest file or through .java code.

The only thing I want is to, provide me some to-the-point code which I can make a new blank project(ABC), set the code in and that should set my app (ABC) the default sms app.

1

There are 1 answers

0
Gábor On

You can't directly set your app to be default, that would be a nasty security risk. What you can do is to signal to the user that you want your status to be changed and the user will decide:

Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT);
intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, activity.getPackageName());
activity.startActivity(intent);

However, to be eligible for becoming a default SMS app, you have to implement all of the functionality required from such an app, and this includes the handling of all SMS/MMS related functionality (sending and receiving, notifications, etc). This practically means that you have to rewrite the complete related functionality of the phone, including all receivers, intents, filters and code (and you should be aware that SMS and especially MMS handling is not part of the system, it requires quite a lot of your own code). And this is also the reason why you won't be able to receive an answer that fits into the confines of a SO answer. Way too much code: basically, a complete app.

There is no way out: if you want the user to replace the default SMS app, the user will rightfully expect that whatever app they choose will continue to support all of the functionality. Unless you provide all that, your app will not be listed among the eligible ones and the intent above will not work.

The Android Developers blog of Google has an article titled Getting Your SMS Apps Ready for KitKat that gives you the very first steps in learning what's expected from you in this scenario.