Broadcast Receiver not processing SMS's

前端 未结 4 560
耶瑟儿~
耶瑟儿~ 2021-01-17 05:01

I\'ve seen on SO that @Commonsware states that all that is needed to receive SMS\'s is a Broadcast Receiver (i.e., without the use of a service). I\'d like to empl

相关标签:
4条回答
  • 2021-01-17 05:41

    Remove the android:priority attribute

    0 讨论(0)
  • 2021-01-17 05:53

    Code seems to me correct. You can try by increasing the priority by max ..

     <intent-filter android:priority="2147483647">
    

    There may be case , when other receiver is getting sms before yours and aborting them.

    0 讨论(0)
  • 2021-01-17 05:54

    Your priority might not be good enough, try setting it to 2147483647.

        <receiver android:name=".SMSReceiver_Test" >
            <intent-filter android:priority="2147483647">
                <action android:name="android.provider.Telephony.SMS_RECEIVED" />
            </intent-filter>
        </receiver>
    

    After doing that, try start it in debug mode, and breakpoint in your onReceive method, or make a Log.i("BroadcastSMSReceiver", "Received something in SMSRECEIVERTEST") :)

    Edit, set priority to a high number instead of 1, just read that high number equals higher priority.

    0 讨论(0)
  • 2021-01-17 05:58

    Based on android developer doc must be -1000>priority<1000 thus highest priority of intent-filter is 999

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