I have to develop an Android App that starts a service on boot. I have the privilege of creating even a new service in framework for it. But before that I have two question so this might be possible without going to framework.
Can an app (service only) signed with system keys be launched without an app launcher and start on boot without any activity ?
This is really another way of asking the first question : Can an app signed with system keys start for the very first time with BOOT COMPLETED broadcast intent ? I am aware that this is not possible for apps in user app space
Further documentation on the topic can be found here
Related
I have a device management application, which essentially runs as a service in the background from boot. I'd like to start this application immediately after installation. How do I achieve this?
You cannot do this -- there is no way to automatically start your service merely because it was installed.
The application must first be invoked by the user through some sort of activity. Or, you are going to need to hook into some relevant broadcast Intent via the manifest, so you can get control when one of those events occur and kick off your service that way. Or, you are going to need to ask the user to reboot so your BOOT_COMPLETED Intent filter can get control.
There was a hole - the Android Analytics SDK used to send an intent right after installation - but that got closed (producing lots of confusion, of course).
But the final answer, I believe, is here:
http://developer.android.com/about/versions/android-3.1.html#launchcontrols
This seems to suggest that, as of 3.1, Google made the decision that apps are in a stopped state until the user explicitly activates them, e.g. by launching app or placing widget.
This means that the strategy of listening of a common broadcast (i.e. to get your app launched surreptitiously) won't work either.
I have a service in my app along with activity classes. I want to start service as soon as app is installed. I have been able to start service on app launch,on device reboot, but not on app install.
Any idea if it is possible and if possible then how it can be done?
Thanks in advance.
Any idea if it is possible
Upon installation, your app is in the so-called "stopped state" and will remain there until something uses an explicit Intent to start up one of your components. Unless your app is a plugin for some other app that will do this, your app will not run until the user taps on the home screen launcher icon associated with one of your activities.
I have an android application that contains only a service, no activities at all.
Is it possible such an application to be started at bootup automatically?
I have read http://blog.gregfiumara.com/archives/82 where it is described how to do it, but it does not work (at least on my side) if there is no activity that is launched after I install the apk.
So this application should run from bootup in the background and should provide periodically CPU usage data on a network.
Is there another way to do it, but without activity be shown?
I have followed the tutorial here :
http://blog.sptechnolab.com/2011/09/14/android/starting-an-android-service-after-boot/
about creating a service, which is activating after boot of Android.
Anyway It practically never started.
I found in here : How to start a Service when .apk is Installed for the first time
that it is not anymore possible since Android 3.0+.
My question is :
How to start a boot service once installed ?
but how to start manually a service, since it does not have any visual elements ?
Add "visual elements", in the form of an activity.
You need an activity anyway, for:
Settings for managing the behavior of this service
Help and instructions for getting support
License agreement
So, write the activity. After the user has launched your activity, your manifest-registered BroadcastReceivers, such as your BOOT_COMPLETED receiver, will work again on Android 3.1+ devices.
In lates android versions you can launch on boot only when user manually started application.
I have a device management application, which essentially runs as a service in the background from boot. I'd like to start this application immediately after installation. How do I achieve this?
You cannot do this -- there is no way to automatically start your service merely because it was installed.
The application must first be invoked by the user through some sort of activity. Or, you are going to need to hook into some relevant broadcast Intent via the manifest, so you can get control when one of those events occur and kick off your service that way. Or, you are going to need to ask the user to reboot so your BOOT_COMPLETED Intent filter can get control.
There was a hole - the Android Analytics SDK used to send an intent right after installation - but that got closed (producing lots of confusion, of course).
But the final answer, I believe, is here:
http://developer.android.com/about/versions/android-3.1.html#launchcontrols
This seems to suggest that, as of 3.1, Google made the decision that apps are in a stopped state until the user explicitly activates them, e.g. by launching app or placing widget.
This means that the strategy of listening of a common broadcast (i.e. to get your app launched surreptitiously) won't work either.