0

My app stopped receiving boot broadcasting on Android 6 (it is working fine on Android 5).

I noticed in the log that the broadcast is being prevented:

I/BackgroundManagerService: prevent from boot complete broadcast: com.mycompany.app

Here is my AndroidManifest.xml:

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

<application
...     
         <receiver android:name="plugin.kiosk.BootService">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                </intent-filter>
         </receiver>
...
</application>

My app package name is : com.mycompany.app and my broadcast class is under a different package (plugin.kiosk).

Has anyone seen that problem? Any clues?

Update: I already tried changing to:

<receiver android:name="plugin.kiosk.BootService" android:enabled="true" android:exported="true" >

but same problem.

Update 2: Tried to add new action (below) and same issue.

<action android:name="android.intent.action.QUICKBOOT_POWERON" />
rsc
  • 10,348
  • 5
  • 39
  • 36

2 Answers2

1

With the help of @Dejvid, I was able to identify that my code was fine and it was something with my tablet.

Indeed I tried my code on another tablet and it all worked.

So, I am guessing there is a strange process on my original tablet that is preventing the broadcasting.

rsc
  • 10,348
  • 5
  • 39
  • 36
0

Do you have <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> permission in your manifest?

Dejvid
  • 470
  • 2
  • 13
  • @rsc does your broadcast extend BroadcastReceiver? I mean in the java code. – Dejvid Apr 12 '17 at 08:28
  • @rsc It is really weird. I have read somewhere that "After installing your app, it needs to be lunch at least once, manually by the user, in order to receive Boot complete event." Have you lunched your app at least once? – Dejvid Apr 12 '17 at 08:34
  • Yes, I read that also. And yes, I opened after I install it and if I simulate the broadcast via adb it opens the app. But If I reboot the tablet, it will not receive the broadcast. I am wondering if it is something on the tablet that is blocking the broadcast (based on the logcat message) – rsc Apr 12 '17 at 08:36
  • @rsc Finally, I read [here](http://stackoverflow.com/a/41808865/7836497) that new android devices have security application by default. some times these apps lock your auto-start mode. – Dejvid Apr 12 '17 at 08:44
  • You can see in the comments that I talked with that guy already. I look in my tablet and didn't see any security app. – rsc Apr 12 '17 at 08:54
  • I didn't notice that, sorry. I have created two different projects using bootcompeted receiver the same way as you did and they both work in android 6.0. I can't tell what is the problem, but it must be your tablet. – Dejvid Apr 12 '17 at 09:01
  • Thanks for testing it. I will then test my code on another tablet to see if I have success. – rsc Apr 12 '17 at 09:03
  • I tested on a new tablet (different manufacturer) and it worked! Thanks for the help @Dejvid. – rsc Apr 12 '17 at 09:29