Will stopService()
stop a service running as a foreground service?
It appears to, but also "feels" like it trumps the importance of foreground services.
The service must stop itself by calling stopSelf(), or another component can stop it by calling stopService(). Once requested to stop with stopSelf() or stopService(), the system destroys the service as soon as possible.
In various older versions of Android, you can tap Settings > Apps or Settings > Applications > Application manager, and tap on an app and tap Force stop. In Android 10, the sequence is Settings > Apps & notifications > App info > [App name] > Disable or Force stop.
A foreground service performs some operation that is noticeable to the user. For example, an audio app would use a foreground service to play an audio track. Foreground services must display a Notification. Foreground services continue running even when the user isn't interacting with the app.
Confirmed: Yes - running stopService()
from an Activity
outside of the service will stop the service -- even if the service is a foreground running service.
It stops the service outright. It doesn't trump any importance, if your code is sending an Intent to stop the service, it would make perfect sense to obey said Intent.
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