Reputation:
Sorry for the sort of click-bait title; I couldn't think of a more concise way to say it.
In Android 13, if the user doesn't grant the "dangerous" POST_NOTIFICATION
permission, then Foreground Service notifications are not shown in the Notification Drawer. Instead, for the user to see it, they have to navigate to the new Foreground Services Task Manager, according to the documentation:
If the user denies the notification permission, they still see notices related to these foreground services in the Foreground Services (FGS) Task Manager but don't see them in the notification drawer.
Now I haven't used the Android 13 Beta so I don't know exactly how "in the face" the FGS Task Manager will be when Foreground Services are running, but I thought the entire point of forcing Foreground Services to have a notification was so that the user would be aware when the application was running. This even has security consequences because Android restricts what background v.s. foreground processes can do using dangerous permissions (e.g. ACCESS_BACKGROUND_LOCATION
). This change essentially allows an app to use foreground based permissions without clearly notifiying the user.
So, why did they decide to restrict Foreground Service notifications? I mean there is a whole other discussion about the addition of restricting notifications in the first place. But one would think that if Android forces you to use a notification, then there shouldn't be a way to get around it (i.e. never request the POST_NOTIFICATION
permission or even just remove the permission programatically).
Upvotes: 35
Views: 20588
Reputation: 1071
So, why did they decide to restrict Foreground Service notifications?
No, they did not restrict Foreground Service notifications at all. Actually, they are always visible in the FGS Task Manager. Below Android 13, it was possible to hide the Foreground Service notifications, when the user forcefully turns them off in settings. But in Android 13, it is always visible (either in notification panel or in FGS Task Manager), no matter whether the user allowed notifications or not.
But one would think that if Android forces you to use a notification, then there shouldn't be a way to get around it
I think the permission is for presenting regular notifications, rather than foreground notifications. In this new way, the foreground services are never hidden (always visible in FGS Task Manager, while other regular notifications are presented according to the user's preference. In short, this method decouples the visibility of regular notifications and foreground service notifications rather than hiding both.
Upvotes: 0
Reputation: 69
From Docs
Starting in Android 13 (API level 33), users can dismiss the notification associated with a foreground service by default. To do so, users perform a swipe gesture on the notification. On previous versions of Android, the notification can't be dismissed unless the foreground service is either stopped or removed from the foreground.
If you would like the notification to be non-dismissable by the user, pass true into the setOngoing()
method when you create your notification using Notification.Builder
.
https://developer.android.com/guide/components/foreground-services#handle-user-initiated-stop
Upvotes: 6
Reputation: 1661
The good side of this change is that you wont have the notification area full of icons. See how it looks like in normal use. And see how it looks when detailed.
If you want a better explanation, check here the documentation.
Upvotes: 10