13

I have the next doubt: I am working on an app that needs to start a foreground service. I know that since Android O, you need to attach a notification to that foreground service. So far so good.

The question is: what happens if the user disables that notification from settings? I have been testing the app and everything seems to work, but I wanted to double check on internet and I couldn't find anything.

Should I force the user to have notifications enabled if he/she wants that feature (which needs the foreground service)?

Does anyone have some insights on it?

Leandro Ocampo
  • 1,894
  • 18
  • 38
  • If user disable notification from settings or force stop application from settings then service will not work further. It is best practice to for the user to have notification enabled. –  Mar 14 '19 at 11:57
  • 1
    @AndroidTeam I did disable notifications from settings and the app did the work without problems.. are you sure about that? I tried to find documentation about this and I could not find it. – Leandro Ocampo Sep 16 '19 at 09:34
  • 1
    @LeandroOcampo Hi, did you get the answer? I'm also very curious about what if users disable notifications when we start foreground services. Thanks! – Liu Tao Feb 20 '20 at 23:03
  • 1
    @LiuTao not yet, but I have been trying in a while ago, and the foreground service was running anyways. But as this is not an official answer from android team, I have the feeling this behaviour can vary in different OS versions. – Leandro Ocampo May 22 '20 at 08:00
  • @LeandroOcampo Did you find an answer to this now, after all this time? – DevAndroid Jul 03 '22 at 10:04
  • @DevAndroid I did not. – Leandro Ocampo Jul 07 '22 at 10:26
  • Even more interesting would be to disable only the exact channel, and even prompt the user to do so, so the app can actually work in the background without that sticky notification. – Chagai Friedlander Jul 18 '22 at 09:12

1 Answers1

-1

Yes, it is best practice to ask the user to enable notification services.

Nowadays most app does this exercise to show a notification to users. Even in some special manufacturer like MIUI it is compulsory to start notification service from setting. So many app shows prompt for same and on positive click they navigate the user to setting screen too

Jaykishan Sewak
  • 822
  • 6
  • 13
  • 1
    Hi! Yeah, I know it is best practices but I am asking about the fact that if the foreground service will work or not if the user disables notification from settings. So far it seems there is no problem and the foreground service does its job but I could not find official documentation about this. – Leandro Ocampo Sep 16 '19 at 09:37