My app targets API 33 (Android 13), and runs a foreground service to play online music.
Once the notification is started via startForeground(notification_Id, notification), I can update the notification via notificationManager.notify(notification_Id, notification). However, Android Studio tells me that the android.permission.POST_NOTIFICATIONS permission is missing.
Even though I include that permission in the AndroidManifest, I don't need to ask the user to grant the permission to update the notification.
Is this method of updating the notification is valid or is it a security hole? Obviously the method works, but I have not found any reference in the documentation of Android 13+
That's fine. No security hole. There are some exemptions that do not require the
POST_NOTIFICATIONSpermission. According to the official documentation, notifications related to media sessions are exempt from this behavior change.MediaStyleuses media session to build up the notification.