SMS Broadcastreceiver not called when GO SMS Pro installed

后端 未结 2 829
遥遥无期
遥遥无期 2020-12-17 21:09

I have implemented an SMS receiver which intercepts incoming SMS messages without any issues. However, when I install GO SMS Pro and set \"Disable other message notificatio

相关标签:
2条回答
  • 2020-12-17 21:44

    "Pretty high" value for priority is just not enough when it comes to Go SMS Pro because they've set their on absolute maximum of 2147483647 (2^31-1). So if you put that value you'll be fine as long as your app is installed before Go SMS Pro is because when on same priority Android OS will pass broadcast to "older" app (This is from my experience, not an official information). If Go SMS Pro is installed prior to your app you should warn your users about the situation. They could configure Go SMS Pro differently or uninstall it and then re install it again so your app can work too.

    0 讨论(0)
  • 2020-12-17 21:53

    go sms pro has set these lines in it's manifest for SmsReceiver:

    <receiver android:name=".smspopup.SmsReceiver"     android:permission="android.permission.BROADCAST_SMS">
            <intent-filter android:priority="2147483647">
                <action android:name="android.provider.Telephony.SMS_RECEIVED" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <intent-filter android:priority="2147483647">
                <action android:name="android.provider.Telephony.GSM_SMS_RECEIVED" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.provider.Telephony.WAP_PUSH_RECEIVED" />
                <data android:mimeType="application/vnd.wap.mms-message" />
            </intent-filter>
            <intent-filter>
                <action android:name="com.android.mms.transaction.MESSAGE_SENT" />
            </intent-filter>
        </receiver>
    

    all these intent-filters make its priority higher than your receiver even if your reciever has the priority set to 2147483647. you can see the list of all receivers of all apps by:

    List<ResolveInfo> receivers = getPackageManager().queryBroadcastReceivers(new Intent("android.provider.Telephony.SMS_RECEIVED"), 0);
    

    the first receiver in the list, receives the sms before than others

    0 讨论(0)
提交回复
热议问题