What are the practical differences between putting a service in a separate process or keeping it in the app's main process? What would each scenario be used for?
A process is an instance of a particular executable (.exe program file) running. A service is a process which runs in the background and does not interact with the desktop.
remember, android is linux: process = any running program. e.g. something with a PID. service = roughly equivalent to a daemon. something running in the background with no direct user interface.
You can do this by making your own Interface where you declare for example " isServiceRunning() ". You can then bind your Activity to your Service, run the method isServiceRunning(), the Service will check for itself if it is running or not and returns a boolean to your Activity.
When a service is running in the main process it will be stopped in case your application crashes for whatever reason. Put a service into it's own process is reasonable for some services which can be used from different applications or services which should run independently from your main app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With