解决方案 »

  1.   

    stackoverflow上有解答,你可以试一下。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 :
    1.
    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.2.
    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.3.
    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.4.
    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.