Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BOOT_COMPLETED not received

Tags:

android

I have created an Android application that should start a service after BOOT. It works just fine on a Nexus 5 phone, but I can not make it work on a Huawei tablet (Mediapad X2). I am using Android 5.0 / API 21.

The manifest has the proper permissions/intents according to the guidelines.

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WAKE_LOCK"/>

    <receiver
        android:name=".BootBroadcast"
        android:enabled="true"
        android:exported="true"
        android:label="BootReceiver">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <action android:name="android.intent.action.QUICKBOOT_POWERON"/>
        </intent-filter>
    </receiver>

I search SO for similar issues (BOOT_COMPLETED not working Android) and have added the QUICKBOOT_POWERON intent, as well as the WAKE_LOCK permission but nothing has changed.

The Broadcast Receiver is just starting the service

public class BootBroadcast extends BroadcastReceiver {

private static final String TAG = "GrandUnion-Boot";

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

    Log.e(TAG, "Boot_Completed RECEIVED");
    try{
        context.startService(new Intent(context,MyService.class));
        Log.i(TAG, "Boot Completed - start service");
    }catch(Exception e){
        Log.e(TAG,e.toString());
    }

}
}
like image 794
Konstantinos Avatar asked Jan 18 '16 13:01

Konstantinos


1 Answers

After long researches I find out, that some devices have their own startup manager. And Huawei Mediapad one of those, so:

  1. Go to the settings of device
  2. Find startup manager
  3. Allow app to start.
like image 185
Дмитрий Басарыгин Avatar answered Oct 14 '22 10:10

Дмитрий Басарыгин