“android.provider.Telephony.SMS_RECEIVED” not working on my device (HTC Wildfire) - how to debug?

前端 未结 4 1144
礼貌的吻别
礼貌的吻别 2020-12-09 06:36

I face really frustrating problem.

I created SMS receiver as most online and book\'s tutorials say.

AndroidManifest.xml:



        
相关标签:
4条回答
  • 2020-12-09 07:02

    I am pretty sure that this code is right. You might not be seeing the Toast message, But the logs would have come. Check the Logcat and you should see the log you have put.

    You should be using Notifications inside BroadcastReceivers and not Toasts.

    0 讨论(0)
  • 2020-12-09 07:09

    GO SMS PRO has priority is 2^31-1 = 2147483647. So your app can not receiver any message because GO SMS service aborted other broadcasts.

    0 讨论(0)
  • 2020-12-09 07:10

    For your Reason & Solution:

    Intent intent = new Intent("android.provider.Telephony.SMS_RECEIVED");
    List<ResolveInfo> infos = getPackageManager().queryBroadcastReceivers(intent, 0);
    for (ResolveInfo info : infos) {
        System.out.println("Receiver name:" + info.activityInfo.name + "; priority=" + info.priority);
    }
    

    And just look through your output for the GO SMS Pro crap. It's probably ridiculously high.

    0 讨论(0)
  • 2020-12-09 07:12

    Reason & Solution:

    I've fix that. "android.provider.Telephony.SMS_RECEIVED" was not working because I had "GO SMS Pro" application installed on my device and there was "Disable other message notification" option checked ("Disable other SMS related apps' notification in notification bar, avoid duplicate notifications."). Unchecking it fixed my problem.

    How to make sure that my broadcast receiver will receive this intent even if some other app blocks it? Due to "android:priority" (Intercept SMS messages in Android and prevent them appearing in Messaging App) how can I know what "priority" is set for "GO SMS Pro" app?

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