But, is it started in ANY or ALL of the following cases?
Your Application
instance is created as part of starting up your process.
App Widget is visible
Simply being visible has nothing to do with your app and its process. Your app and its process will get involved for populating the app widget, when it is created and when it is updated. If, for example, updatePeriodMillis
is triggering updates, and when the time comes around, you do not have a process, then an Application
instance is created as part of starting up the process, before the AppWidgetProvider
is called with onUpdate()
.
Broadcast receiver receives something
If your process already existed, your Application
instance already existed. If your process did not exist, then an Application
instance is created as part of starting up the process, before the BroadcastReceiver
is called with onReceive()
.
Push notification arrives to device and show message
If you mean GCM, since this comes in as a broadcast, see above.
Push notification is clicked after the app has been closed
I have no idea what you mean by this.
Service is started
If your code is starting the service, then your process was already running and you already have an Application
. If some other process is starting your service, and your process is not running, then an Application
is created, before the Service
, as part of creating your process.
And how long will the Application process will be kept alive?
If by "Application process", you mean "process", your process will be around for somewhere between a millisecond and a millennium, roughly speaking. It will be around until Android terminates it to free up system RAM for other apps, or until something specifically gets rid of it (e.g., "task killer", force-stop in Settings).