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");
}
}
}