How To Make Your Android App The Default SMS App

 

SMSs are still here with us, 30 years later. Software engineers have built amazing experiences around SMSs complimenting stock SMS clients (SMS Apps that come with your phone/device). To do this, it  is a requirement to make the mobile application the default messaging app running on the Android phone/device.

 

Steps

1. Android Manifest

Set up your manifest to have the following: 

 

2. Broadcast Receivers

Have a broadcast receiver to allow your Android app to receive incoming SMS messages.

 

Have another broadcast receiver to allow your Android app to receive incoming MMS messages.

 

 

3. Activity

This activity could be where you would have the bulk of the default SMS app functionality i.e. send SMS, view SMS etc. 

 

There’s a function areWeTheDefaultMessagingApp() that checks for the default SMS app on the device and returns a boolean (false if the Android app you are building is not the default SMS app). How it is currently set up on the codebase is that the button, when clicked, invokes the said function and depending on the returned value, the option of selecting the default SMS app runs. One should not be limited to doing the same using a button, you can have the function running when the app starts.

 

Google announced an impending modification to the way the OS handled SMS apps just before releasing Android 4.4 “Kit Kat”. In the past, your Android device could be configured to receive or send SMS messages from any number of apps. Google has attempted to tighten all of that with Kit Kat, restricting the OS to essentially letting only one app send and receive SMS and MMS messages.

 

4. Intent Service

There could be occasions where you might want users to promptly reply to incoming phone calls by sending an instant text message.

 

The above codebase is also available on Github 

 

Symatech Labs is a Software Development company based in Nairobi, Kenya that specializes in Software Development, Mobile App Development, Web Application Development, Integrations, USSD and Consultancy.