Reboot receiver is not working in xiaomi phones

后端 未结 10 1737
余生分开走
余生分开走 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:20

    Try to disable the MUIU Optimization from the Developer Options. It worked for me.

    1- Go to Settings

    2- Open Additional Settings

    3- Open Developer Options

    4- Find the Turn on MIUI optimization

    5- Disable the switch button.

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

    Xiaomi phones running MIUI have a inbuilt startup apps blocker. Maybe that is interfering with your boot receiver.

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

    You need to add

    android:enabled="true"
    

    and

    android:exported="true"
    

    exported can be false, but it is necessary to include exported.

    I think it's a problem with ROM Xiaomi.eu, tested with the dev version, I used the MIUI 6.5.19 Beta version 7.4 on a Xiaomi Redmi Note 2 Prime. I have not checked with the stable version that can not be downloaded at this time for server maintenance. Broadcast receiver doesn't work on boot.

    Probe the same app in a Xiaomi Mi 4 with stable Xiaomi Global ROM, MIUI 7.1.2, there worked perfectly after activating the autostart in the manager. Restart and perfectly worked the broadcast receiver and permissions required.

    Now, I tested with Xiaomi.EU 7.3 stable, MIUI 7.3.2, Broadcast receiver works fine on boot and reboot. I registered my receiver with autostart in security manager, it doesn't work in ROM dev version. I don't tested with Xiaomi Official ROM Global dev.

    My permissions:

    <receiver android:name=".service.BootBroadcastReceiver"
      android:enabled="true"
      android:exported="true">
      <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
        <action android:name="android.intent.action.QUICKBOOT_POWERON" />
        <action android:name="android.intent.action.REBOOT"/>
        <category android:name="android.intent.category.DEFAULT" />
      </intent-filter>
    </receiver>
    
    0 讨论(0)
  • 2020-12-17 09:31

    Try adding the android.intent.category.DEFAULT category. It is mandatory for implicit intents, but maybe it is being tweaked for some reason in Xiaomi phones and the intent is not passing one of the tests to being received by your application.

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