In an interview recently, the interview asked if it is possible to start service after just installing the app without starting it?
Is it possible to do?
In an interview recently, the interview asked if it is possible to start service after just installing the app without starting it?
Is it possible to do?
Yes you can. I don't know if it is enough with the receiver android.intent.action.PACKAGE_INSTALL because I always thought that was related to other app installs. But you can capture the BOOT event, or the connectivity change event or something like that to start a service or whatever you want.
It is not supposed to be possible.
Apps are installed in a "stopped state", the same state that they are in after the user presses "Force Stop" on the app's page in Settings. While in that "stopped state", it takes an explicit
Intent
to cause any of that app's code to run. In most apps, that means that the user taps the home screen launcher icon for the app.