Reboot receiver is not working in xiaomi phones

后端 未结 10 1736
余生分开走
余生分开走 2020-12-17 08:31

Hi We are working on an android application where we are using reboot receiver in which I am starting few services where I am performaning some network operation.

I

相关标签:
10条回答
  • 2020-12-17 09:10

    Xiomi has a reported bug for only using this reciever 5 minutes after the system
    actually boot-up -
    http://xiaomi.eu/community/threads/alarmmanager-_wakeup-problem.21430/
    You can try and add the -

    android:enabled="true" and android:exported="true"
    even though they should be set to true by default due to manufacturer system changes
    it might be different on Xiomi android customized OS.
    Just pay attention for their meaning
    Since the android:exported="true"
    Will let other applications access to your reciever.

    0 讨论(0)
  • 2020-12-17 09:14

    There is an internal feature of MIUI which prevents apps from restarting for saving battery & RAM. You have to manually toggle Auto Start option on in order to receive broadcast for BOOT_COMPLETED. Go to Settings> Installed Apps> Your App. Then just toggle on the auto start option. There is no option to prevent this programmatically. Instead, you can inform your app's users if they face problems while using your app (ex: Alarm is not triggering properly), they can enable Auto Start from Settings.

    0 讨论(0)
  • 2020-12-17 09:15

    Add this in your manifest file in intent-filter

    <action android:name="android.intent.action.BOOT_COMPLETED" />
    
    0 讨论(0)
  • 2020-12-17 09:17

    I was suggesting to add android:enabled="true" but it was already offered.

    So I can tell you that you first make sure yourself if the receiver registered properly or not. You can also try the other version of registering it - that is doing registration programmatically (preferably in onPause() & onResume()) and see if it's receiving the broadcast message or not.

    0 讨论(0)
  • 2020-12-17 09:19

    Ok, let's try again. MIUI has a a built-in Security app. In the Security app there is a 'Startup' section, where the user can configure which app can and which app can't run on startup. Your application is disabled default. Also if you examine your Logcat you can see a "permission denied" message at startup. Put your app manually to the whitelisted apps, unfortunately that is your users can only do.

    0 讨论(0)
  • 2020-12-17 09:20

    you should see here. In Xiaomi devices, they block some permissions even if you require it. The only way to slove it is you must allow your app this permission manually.

    0 讨论(0)
提交回复
热议问题