Android - how to make my app default sms app programatically

后端 未结 2 933
日久生厌
日久生厌 2020-12-16 08:34

I am developing an sms blocking app. Which is working fine up to Jelly-Bean. And its not working from Kitkat to Marshmallow. I searched on google and everyone recommending t

2条回答
  •  臣服心动
    2020-12-16 09:22

    I followed it

    Not according to the code in your question. Let's review the four requirements from the blog post:

    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.

    You have this, in the form of your PhoneStateReceiver.

    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.

    You do not have this.

    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:.

    You have this, in the form of DashboardActivity.

    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.

    You have this, in the form of HeadlessSmsSendService.

    So, add a for WAP_PUSH_DELIVER_ACTION, following the instructions, and see if that helps.

提交回复
热议问题