简体   繁体   中英

How can I make my ForegroundService to show notifications on Android 13?

My app was working fine until I used it on an Android 13 phone. On this phone, my ForegroundService doesn't display a notification as in this screenshot , but it's visible in the Foreground Services (FGS) Task Manager as per the documentation .

I put the POST_NOTIFICATIONS permission in the manifest, but I still can't see the foreground notification and I need it visible at all times, as my app manages calls that I want to answer/reject/end from notifications.

to make it work the same on Android 13, you need to ask for the POST_NOTIFICATIONS permission also at runtime! See the documentation for the changes that came with Android 13.

Adding a Manifest.permission.POST_NOTIFICATIONS ALSO to your existing permissions request should solve the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM