Search code examples
androidboot

Auto Start Service after booting device even app not opened atonce. Android


I am making a system app. In that I have a requirement is to run a service after boot load WITHOUT A SINGLE TIME LUNCHING THE APP. this question is bit similar to this System App auto starting But it does not have any appropriate solution. Also read that BOOT_COMPLETE_RECEIVER works only when app launched at once.


Solution

  • Thanks all for your effort, I finally got answer. Solution: As I stated my app is system app, System work even they not opened at once. Because they are not in stopped state i.e enforce after android 3.1.

    Secondly If a user app wants this then Its manifest don't have any "android.intent.category.LAUNCHER" category in activity.

    Also by adb you can enable your app by using this command adb shell am broadcast -a com.example.demo.action.LAUNCH --include-stopped-packages (This is not tested)

    Some good link to this: http://droidyue.com/blog/2014/01/04/package-stop-state-since-android-3-dot-1/ Static BroadcastReceiver not Working after Installation from ADB