22

I'm getting an java.lang.IllegalArgumentException with the following message regist too many Broadcast Receivers (yes, the message says regist and not register) when trying to get the latest ACTION_BATTERY_CHANGED sticky intent. I use the following code:

Intent latestStickyIntent = getApplicationContext().registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));

As you can see, there is no actual register of a new receiver since i'm using null as the BroadcastReceiver.

As far as I can see, this only happens for a single user on a HUAWEI RIO L01 device but I can't say if that's the cause.

Anyone had a similar experience with that error?

UPDATE (03/2016):

Started seeing the same issue on other Huawei devices (ALE L04, G7 L03) but still no devices from other manufacturers.

enter image description here

11
  • 3
    You have clarified if he uses a custom rom? Feb 5, 2016 at 9:26
  • 1
    just for interest: why You are passing null instead of a BroadcastReceiver? Feb 5, 2016 at 9:38
  • @Opiatefuchs registering a null receiver only gets you the latest sticky without actually registering a new receiver
    – Muzikant
    Feb 5, 2016 at 10:08
  • pff...sorry, if had read the question carefully, I hadn´t to aks :)..... Feb 5, 2016 at 10:21
  • 3
    I'm experiencing the same problem on HUAWEI RIO L01 but using the Glide library because under the hood it uses a broadcast receiver to monitor the connectivity changes. Obliviously this is an issue in the Huawei code.
    – rciovati
    Mar 22, 2016 at 18:05

1 Answer 1

4

This is the confine of huawei's mobile phone system. Huawei's mobile phone has a white list mechanism. Only the APP in their white list can avoid this bug. I use reflection to try to solve this bug. may help for you

https://github.com/llew2011/HuaWeiVerifier

How to usage

dependencies {
    // add dependencies
    implementation 'com.llew.huawei:verifier:1.0.2'
}


public class SimpleApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        LoadedApkHuaWei.hookHuaWeiVerifier(getBaseContext());
    }
}

That all

1
  • I saw this error on firebase now. And it is huawei.
    – woltran
    Dec 28, 2018 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.