0

I noticed that my Huawei test device (Huawei P20) does not detect action BOOT_COMPLETED, while other test devices do (Samsung ...). I know that adding my application under-protected apps (Manual Mode) would solve my problem, but my end users do not know how to add application under-protected apps. Is there any way to detect system BOOT without adding application under-protected apps (Manual mode)?

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> 
<receiver android:name=".recivers.BootBroadcastReceiver">
    <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
        <action android:name="android.intent.action.QUICKBOOT_POWERON" />
    </intent-filter>
</receiver>

Receiver:

public class BootBroadcastReceiver extends BroadcastReceiver {

    private static final String TAG = "BootBroadcastReceiver";

    @Override
    public void onReceive(Context context, Intent intent) {

        String action = intent . getAction ();

        if (action != null && action.equals(Intent.ACTION_BOOT_COMPLETED)) {

            Toast.makeText(context, "BOOT", Toast.LENGTH_LONG).show();
            Log.e(TAG, "BOOT");

        }

    }
}
Birju Vachhani
  • 6,072
  • 4
  • 21
  • 43
user2919628
  • 9
  • 1
  • 3

1 Answers1

0

I also had that problem, what happens is that huawei has a layer where it controls the applications that implies restarting them. You have to go to Settings -> Battery -> Automatic start

As they mention it here Intent BOOT_COMPLETED not working on Huawei device