Broadcast Receiver not processing SMS's

青春壹個敷衍的年華 提交于 2019-12-01 14:06:18

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.

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.

Remove the android:priority attribute

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!