1

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.

6
  • Does this answer your question? Intent BOOT_COMPLETED not working on Huawei device Commented Jan 16, 2020 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. Commented Jan 16, 2020 at 12:14
  • does this help? Commented Jan 16, 2020 at 12:17
  • You'll have this problem on all Chinese phones I haven't found a solution for this yet :(( Commented Jan 16, 2020 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. Commented Jan 16, 2020 at 12:21

2 Answers 2

1

On Huawei and Honor smartphones, the user must independently give permission for autorun after reboot. Settings->Battery->(your app)->Autorun settings->Automatic control uncheck the box. I understand that your question is old, and you have most likely already solved the problem. But I'm posting this for the rest of the people, as the solution to the problem is very implicit.

Sign up to request clarification or add additional context in comments.

Comments

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.