1

I am trying to run my service even if user has never opened the app before. Just installed it and never opened. Is it possible to receive android.intent.action.BOOT_COMPLETED action in this situation?

I have tried all bootup suggestions I can find. They work if I open the app once. If not, no action.

I can have root permissions if super user is needed, but not able to find any related idea or problem.

Any help would be greatly appreciated.

slhddn
  • 1,917
  • 1
  • 15
  • 21

2 Answers2

3

Is it possible to receive android.intent.action.BOOT_COMPLETED action in this situation?

No, as of Android 3.1. Something must use an explicit Intent to start one of your components before you can receive broadcasts like ACTION_BOOT_COMPLETED. The typical way this is done is for the user to launch your app from the home screen launcher.

I can have root permissions if super user is needed

There may be some hack to move your app out of the "force stopped state" that it is in on first install, but that would be way outside the bounds of the Android SDK and therefore intrinsically unreliable.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Does google install tracker can help him, to auto lunch his app by him self? – Ilya Gazman Dec 31 '13 at 13:26
  • No, I had a look at it. I believe it is useless for me. @CommonsWare, let me repeat my comment above: Is it possible to run an app with a shell script or stg like this after the app is installed? How do device manufacturers handle this? Assume I am a manufacturer, what should I do to run my own apps after installing? – slhddn Dec 31 '13 at 13:30
  • @Babibu: "Is it possible to run an app with a shell script or stg like this after the app is installed?" -- you could try using the **`am`** command, though that will definitely require root. "How do device manufacturers handle this?" -- their apps are pre-installed. – CommonsWare Dec 31 '13 at 13:47
  • @akguncse read the comment CommonsWare wrote for me, it was mention for you. – Ilya Gazman Dec 31 '13 at 13:49
  • Thanks for the answers. @CommonsWare, it is clear for me now. I know I asked too much. One last question :) How pre-installed apps can be started automatically? Do they have special permissions or do they need to be started for running? Could you share a link, document about this? Most documents about pre installed apps are for uninstalling them. – slhddn Dec 31 '13 at 15:03
  • @akguncse: "How pre-installed apps can be started automatically?" -- presumably, the act of installing an app is what marks it as "force stopped" at install time. Beyond that, I cannot help you. – CommonsWare Dec 31 '13 at 15:09
2

I believe this is impossible. You can start a service from a never opened app with another app though.

Edward van Raak
  • 4,841
  • 3
  • 24
  • 38
  • Edward, I didn't understand what you mean. You mean I can run the service/app from another running app? If so, this is not useless. Well, then is it possible to run an app with a shell script or stg like this after the app is installed? How do device manufacturers handle this? Assume I am a manufacturer, what should I do to run my own apps? – slhddn Dec 31 '13 at 13:16