-1

I am trying to get a BOOT_COMPLETED receiver to work on a Galays S5 Neo device (running 5.1.1) to start a service right after the device is fully booted.

So in the manifest i defined

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

and also added a receiver for the BOOT_COMPLETED intent

<receiver android:name="com.xyzMyApp.BootCompleteReceiver" >
    <intent-filter android:priority="999" >
        <action android:name="android.intent.action.BOOT_COMPLETED" />
    </intent-filter>
</receiver>

This works fine on nearly all devices no matter if used on battery or not. On the Galaxy S5 Neo this is only working when the device is connected to power on boot. If i use the device on battery and do a reboot, it can take up to 5 minutes until the intent is received.

I also tried to receive other broadcasts like android.net.wifi.RSSI_CHANGED or android.intent.action.USER_PRESENT or android.intent.action.TIME_TICK to maybe use them as a replacement for the boot completed event. The idea was that those events happen pretty often and so after a reboot it won't take very long until one of the receivers is triggered. Turns out that the behavior is the same, on battery it can take up to some minutes until ANY of the receivers receives ANY intent.

I also disabled all kinds of battery optimization for apps i found in the system settings but that did not solve the issue.

Thanks for every hint or idea.

homtg
  • 1,999
  • 1
  • 15
  • 20

1 Answers1

0

Try to add QUICKBOOT_POWERON as some devices have issues in receiving BOOT_COMPLETED broadcast:

<receiver android:name="com.xyzMyApp.BootCompleteReceiver">
    <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED"/>
        <action android:name="android.intent.action.QUICKBOOT_POWERON" />
    </intent-filter>
</receiver>

Also make sure your app is not installed on external storage(SD card) as suggested on this answer

Community
  • 1
  • 1
mgcaguioa
  • 1,443
  • 16
  • 19
  • thanks, i tried, seems like this is not a bootup_completed issue because no event works immediately after boot, not only the boot events – homtg Jun 14 '16 at 09:12