1

If an Android user hides an application's notifications from being shown, in Android 9+, either by entire application or by hiding a specific notification channel, can Services still be started using startForeground() with a valid Notification object?

I am starting a foreground service that may run indefinitely and is not dismissible. I would like to provide an action button in the notification to navigate the user to the Notifications settings and give the option to hide the persistent foreground notification without losing any functionality that is gained by having a foreground service.

Question: If a user disables a notification channel manually, and my application calls startForeground() with a valid Notification object and specifies the disabled channel, will the Service still start properly, and will it be considered a "foreground" service by the Android OS (even though the notification is not shown)?

DanielG
  • 292
  • 1
  • 3
  • 12
  • it should be. user just do see the notification – Elias Fazel Jan 29 '20 at 22:50
  • Does this help? https://stackoverflow.com/questions/47678213/android-8-foreground-service-with-notification-channel – omz1990 Jan 29 '20 at 23:55
  • Does this answer your question? [Android 8 Foreground Service with Notification Channel](https://stackoverflow.com/questions/47678213/android-8-foreground-service-with-notification-channel) – greeble31 Jan 30 '20 at 01:52
  • Thank you @omz1990 for the link. I am still trying to answer the question for Android 9.0+, not just Android 8, and I would like to know: is the service is still running properly and considered a "foreground" service when the notification channel is turned off by the user? – DanielG Jan 30 '20 at 21:35
  • 1
    You can expect that this behavior will not change for Android 9.0+, and that it is still considered a foreground service. Everything is the same, except no notification is onscreen. – greeble31 Jan 31 '20 at 15:36
  • Thank you @greeble31, Devs at Google and some of my testing have also confirmed that you are correct. – DanielG Feb 08 '20 at 00:04

0 Answers0