Enabling SMS support in Hangouts 2.0 breaks the BroadcastReceiver of SMS_RECEIVED in my app

前端 未结 5 1595
感动是毒
感动是毒 2020-12-03 04:44

I just received the update for Hangouts 2.0, installed it and enabled SMSTurn on SMS. Now my application, running under Android 4.3, is una

5条回答
  •  失恋的感觉
    2020-12-03 05:33

    Fixed it.

    The first problem was that, as you can see in revision 2 of my question, I put the priority attribute within the action element, when it actually belongs into the intent-filter element. So the priority didn't work.

    While still targeting API 19, I did some experiences with Hangouts SMS enabled and different priorities.

    • No priority set → BroadcastReceiver doesn't receive SMS_RECEIVED intent
    • Priority 500 → BroadcastReceiver does receive SMS_RECEIVED intent
    • Priority 9991 → BroadcastReceiver does receive SMS_RECEIVED intent

    So it seems that you need to have a minimum value for priority in order to get the intent with Hangouts SMS enabled. I didn't bother to bisect the lowest possible value. ;) I am going with 999 as I don't see any reason to get lower because my app does just some quick checks on the received sms and does not further process it. But it should really make a difference, as the broadcast is non-abortable.

    1The maximum value

提交回复
热议问题