安装GO SMS Pro时未调用SMS Broadcastreceiver

dav*_*ice 9 android

我已经实现了一个短信接收器,可以截获传入的短信而不会出现任何问题.但是,当我安装GO SMS Pro并设置"禁用其他消息通知"时,即使我已将意图过滤器的优先级设置得非常高,我的应用程序也不会收到任何广播消息.有没有办法克服,以便我的应用程序总是收到短信广播,无论用户在Go SMS Pro的应用程序上做什么,特别是因为我的应用程序没有显示任何UI弹出通知?一旦我卸载GO短信加强版,我的应用程序开始收到传入的短信广播,并正常工作.

这是收到传入短信并安装GO SMS Pro时的日志.GO SMS Pro有一些神奇的功能,我不明白.有人可以解释这里做了什么,我怎样才能确保我的应用每次都能得到有序的广播通知.

07-02 19:52:21.674: INFO/Zygote(25209): Zygote: pid 25209 has INTERNET permission, then set capability for CAP_NET_RAW

07-02 19:52:21.820: INFO/ActivityThread(25209): Publishing provider go-sms: com.jb.gosms.provider.GoSmsProvider

07-02 19:52:21.830: INFO/ActivityThread(25209): Publishing provider go-mms-sms: com.jb.gosms.provider.GoMmsSmsProvider

07-02 19:52:21.834: INFO/ActivityThread(25209): Publishing provider com.jb.gosms.im;com.jb.gosms.chat: 
com.jb.gosms.im.database.ImContentProvider

07-02 19:52:21.842: INFO/ActivityThread(25209): Publishing provider com.jb.gosms.schedule.Schedule: com.jb.gosms.schedule.ScheduleProvider

07-02 19:52:21.846: INFO/ActivityThread(25209): Publishing provider go-mms: com.jb.gosms.provider.GoMmsProvider

07-02 19:52:21.959: DEBUG/dalvikvm(25209): GC_FOR_MALLOC freed 2657 objects / 173112 bytes in 30ms

07-02 19:52:22.182: DEBUG/dalvikvm(25209): Trying to load lib /data/data/com.jb.gosms/lib/libHanzi2Pinyin.so 0x47d4cf70

07-02 19:52:22.182: DEBUG/dalvikvm(25209): Added shared lib /data/data/com.jb.gosms/lib/libHanzi2Pinyin.so 0x47d4cf70

07-02 19:52:22.182: DEBUG/dalvikvm(25209): No JNI_OnLoad found in /data/data/com.jb.gosms/lib/libHanzi2Pinyin.so 0x47d4cf70, skipping init

07-02 19:52:22.186: INFO/Hanzi2Pinyin_Native(25209): InitLib in ver=3141000

07-02 19:52:22.186: INFO/Hanzi2Pinyin_Native(25209): Init in

07-02 19:52:22.186: INFO/Hanzi2Pinyin_Native(25209): file size=155203 

07-02 19:52:22.186: INFO/Hanzi2Pinyin_Native(25209): Init out

07-02 19:52:22.186: INFO/Hanzi2Pinyin_Native(25209): Instance out Init = 21

07-02 19:52:22.186: INFO/Hanzi2Pinyin_Native(25209): InitLib out

07-02 19:52:22.467: DEBUG/dalvikvm(25209): GC_FOR_MALLOC freed 5960 objects / 376104 bytes in 29ms

07-02 19:52:22.815: DEBUG/IMS/Ims3GPP2SmsMessage(25209): IMSLogcreateFromPdu : calling parsePdu

07-02 19:52:22.815: DEBUG/IMS/Ims3GPP2SmsMessage(25209): IMSLogpdu to parse : 000002100202070292A106A85A0008150003100730010610254E9D3A000306110702195220

07-02 19:52:22.815: DEBUG/IMS/Ims3GPP2SmsMessage(25209): IMSLogparseAddress

07-02 19:52:22.815: DEBUG/IMS/Ims3GPP2SmsMessage(25209): IMSLogaddress received :3233292992

07-02 19:52:22.815: DEBUG/IMS/Ims3GPP2SmsMessage(25209): IMSLogbearer data received : 0003100730010610254E9D3A000306110702195220

07-02 19:52:22.815: ERROR/bearer data(25209): bearer data obtained 1

07-02 19:52:22.815: DEBUG/EMS(25209):  messageType is 1 messageId is 115 hasUserDataHeader is false

07-02 19:52:22.858: DEBUG/IMS/Ims3GPP2SmsMessage(25209): IMSLogcreateFromPdu : calling parsePdu
Run Code Online (Sandbox Code Playgroud)

Nem*_*vic 12

对于Go SMS Pro来说,"相当高"的优先级值是不够的,因为他们将其绝对最大值设置为2147483647(2 ^ 31-1).因此,如果你把这个值放在你的应用程序安装之前你就可以了,因为在相同的优先级Android OS会将广播传递给"旧"应用程序(这是根据我的经验,而不是官方信息) .如果在应用程序之前安装了Go SMS Pro,则应警告用户有关此情况.他们可以不同地配置Go SMS Pro或卸载它然后重新安装它,这样你的应用程序也可以工作.

  • 我还将我的应用程序的优先级设置为2147483647,即使在我的应用程序之后安装了短信,gosms仍会拦截短信.有任何想法吗??? (2认同)

Sha*_*yan 5

go sms pro已经在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>
Run Code Online (Sandbox Code Playgroud)

所有这些意图过滤器的优先级都高于您的接收器,即使您的接收器的优先级设置为2147483647.您可以通过以下方式查看所有应用程序的所有接收器列表:

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

列表中的第一个接收者比其他接收者接收短信