0

I am currently working on a reminder app and the BootReceiver is not executed when the Huawei device is rebooted. I have tested the app in other android devices and it works perfectly, except for Huawei specific devices. I have tried the following.

Manifest file

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

<receiver
    android:name=".BootService"
    android:enabled="true"
    android:exported="true">
    <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
        <action android:name="android.intent.action.REBOOT" />
        <action android:name="android.intent.action.QUICKBOOT_POWERON"/>
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</receiver>

BootService class

public class BootService extends BroadcastReceiver {
    private static final String TAG = "BootService Lumea";
    @Override
    public void onReceive(Context context, Intent intent) {
        Log.d(TAG, "Boot Completed Received: " + intent);
        Toast.makeText(context, "Boot Completed Received", Toast.LENGTH_SHORT).show();
    }
}

Would be really helpful if you guys can help me find a solution for the same.

  • Does this answer your question? [Intent BOOT\_COMPLETED not working on Huawei device](https://stackoverflow.com/questions/43913937/intent-boot-completed-not-working-on-huawei-device) – Rahul Gaur Jan 16 '20 at 12:12
  • No not really since I am looking for a solution such that the user does not exit the app and manually changes the settings. – Sreevidya K Jan 16 '20 at 12:14
  • does [this](https://stackoverflow.com/q/41791150/7948109) help? – Rahul Gaur Jan 16 '20 at 12:17
  • You'll have this problem on all Chinese phones I haven't found a solution for this yet :(( – Amirhf Jan 16 '20 at 12:19
  • This requires, the user to explicitly change the settings for the app. I am looking for a solution where we can programmatically whitelist the app, without any user interaction in settings. – Sreevidya K Jan 16 '20 at 12:21
  • Keep an eye out for a solution on https://dontkillmyapp.com/huawei . It gets updated whenever there's something available to do either programmatically or by prompting the user to change some settings. – Nikos Hidalgo Jan 16 '20 at 12:26

1 Answers1

0

There is no doubt that there is a system broadcast in the behavior of power on. The idea is that we can register a broadcast in our code, and it's basically a static broadcast to do this. Here's a sample code. Let's inherit a broadcastreceiver and find a fixed action, that is, get the android.intent.action .BOOT_ Completed, make a logical judgment in it. Here is skill link https://blog.csdn.net/u011174639/article/details/106120684?utm_medium=distribute.pc_relevant.none-task-blog-baidujs-1

Mary
  • 11
  • 1