Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.IllegalArgumentException: register too many Broadcast Receivers

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

like image 496
Muzikant Avatar asked Feb 05 '16 09:02

Muzikant


1 Answers

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

like image 69
llew Avatar answered Nov 20 '22 16:11

llew