Question

I would change default sms app on Android 4.4.2

I use this code:

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

How can i solve this? And how can i ask to change default sms app with my app?

My Receiver:

<receiver android:name="receiver.SMSHandlerReceiver"
     android:permission="android.permission.BROADCAST_SMS" >
      <intent-filter>      
        <action android:name="android.provider.Telephony.SMS_DELIVER" />

            </intent-filter>
        </receiver>

Thank you.

Était-ce utile?

La solution

It seems that if you want your app to appear in default sms app settings, you must first make it eligible, or else you can not set your app as default sms app. I had the same problem so I did those simple steps and then I could chose my app as default, in settings and in my code, which I could not before.

So :

  • You must Have an Activity including an intent filter with an ACTION_SENDTO ("android.intent.action.SENDTO" ) and with schemas sms, smsto, mms, and mmsto. Do it in your manifest file. What I did was creating an empty activity that I will not use, with those parameters.

  • Do the same, by creating an empty Service including an intent filter with ACTION_RESPOND_VIA_MESSAGE ("android.intent.action.RESPOND_VIA_MESSAGE") and with schemas, sms, smsto, mms, and mmsto. This service must also require the SEND_RESPOND_VIA_MESSAGE permission. You must add all required permissions in your manifest.

  • Create an empty BroadcastReceiver including an intent filter with 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. You must add all required permissions in your manifest.

  • Create an empty BroadcastReceiver including an intent filter with SMS_DELIVER_ACTION ("android.provider.Telephony.SMS_DELIVER"). The broadcast receiver must also require the BROADCAST_SMS permission. You must add all required permissions in your manifest.

It important to set all these parameters without missing one. Once you made all these steps, your app will be eligible and you can then set it as default sms app, leaving those created classes empty, and sticking with you old way of doing things. The goal is simply set your app as default, so it will be fully fonctionnal like it was before, without code modification.

Autres conseils

I would change default sms app on Android 4.4.2

You cannot change the default SMS app. You can, however, ask the user to change the default SMS app, using Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT. This is covered in the official blog post on the SMS changes in Android 4.4.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top