I made an android sms app in which I am sending and receiving sms as android messaging app does so. Now I have set my target to 4.4 (Android KitKat version) but Android KitK
The instructions you posted were correct - the issue is that you must implement all of the required capabilities:
In a broadcast receiver, include an intent filter for SMS_DELIVER_ACTION
("android.provider.Telephony.SMS_DELIVER
"). The broadcast receiver must also require the BROADCAST_SMS permission.
This allows your app to directly receive incoming SMS messages.
In a broadcast receiver, include an intent filter for WAP_PUSH_DELIVER_ACTION
("android.provider.Telephony.WAP_PUSH_DELIVER
") with the MIME type "application/vnd.wap.mms-message
". The broadcast receiver must also require the BROADCAST_WAP_PUSH permission.
This allows your app to directly receive incoming MMS messages.
In your activity that delivers new messages, include an intent filter for ACTION_SENDTO
("android.intent.action.SENDTO
") with schemas, sms:
, smsto:
, mms:
, and mmsto:
.
This allows your app to receive intents from other apps that want to deliver a message.
In a service, include an intent filter for ACTION_RESPONSE_VIA_MESSAGE
("android.intent.action.RESPOND_VIA_MESSAGE
") with schemas, sms:
, smsto:
, mms:
, and mmsto:
. This service must also require the SEND_RESPOND_VIA_MESSAGE
permission.
Without all four, your app will not be listed in the default SMS selection dialog.
If you don't implement all the four requirements, your app won't be listed as a default SMS app. Even if your app doesn't support MMS you've to add those to your manifiest file. It doesn't mean you've to implement activities or services or receivers for them. Add these to your manifiest file and should get your SMS listed as a default SMS app. Feel free to ignore any lint errors.
<!-- BroadcastReceiver that listens for incoming MMS messages -->
<receiver android:name=".MmsReceiver"
android:enabled="@bool/is_kitkat"
android:permission="android.permission.BROADCAST_WAP_PUSH">
<intent-filter>
<action android:name="android.provider.Telephony.WAP_PUSH_DELIVER" />
<data android:mimeType="application/vnd.wap.mms-message" />
</intent-filter>
</receiver>
<!-- Activity that allows the user to send new SMS/MMS messages -->
<activity android:name=".ComposeSmsActivity" >
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="sms" />
<data android:scheme="smsto" />
<data android:scheme="mms" />
<data android:scheme="mmsto" />
</intent-filter>
</activity>
<!-- Service that delivers messages from the phone "quick response" -->
<service android:name=".HeadlessSmsSendService"
android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.RESPOND_VIA_MESSAGE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="sms" />
<data android:scheme="smsto" />
<data android:scheme="mms" />
<data android:scheme="mmsto" />
</intent-filter>
</service>