Skip to content Skip to sidebar Skip to footer

Why Broadcast Receiver Is Causing Anr On Only Huawei Devices?

I have a broadcast receiver(Manifest declared) that listens to an intent and starts the jobIntentService. Since jobIntentService is using Worker Threads and Broadcast Receiver does

Solution 1:

You probably need to add your app to the list of "protected" apps, or the list of apps that are allowed to run in the background. On many low-end devices, and devices from Xiaomi, Huawei, etc. Android will not start (or restart) apps automatically unless they have been explicitly added to this list. Look in Settings under Battery, Power Management or Security.

See the following for more info:

BroadcastReceiver works for a while, then stops

"Protected Apps" setting on Huawei phones, and how to handle it

Also, you can try

GO to settings -> Apps -> Menu on right top corner -> Special access -> Battery Optimization. Select your app , and click on "Don't Allow" .

Solution 2:

Based on the above analyses, this issue is not related to SessionReceiver but should be something in the app navigations/ UI that blocks the main thread. With the main thread blocked, broadcast receivers will also be blocked in the main thread and finally cause ANR.

Post a Comment for "Why Broadcast Receiver Is Causing Anr On Only Huawei Devices?"