[英]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.我的应用程序运行良好,直到我在 Android 13 手机上使用它。 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 .在这部手机上,我的 ForegroundService 没有像此屏幕截图中那样显示通知,但根据文档,它在前台服务 (FGS) 任务管理器中可见。
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.我将POST_NOTIFICATIONS权限放在清单中,但我仍然看不到前台通知,我需要它始终可见,因为我的应用程序管理我想从通知中接听/拒绝/结束的呼叫。
to make it work the same on Android 13, you need to ask for the POST_NOTIFICATIONS permission also at runtime!要使其在 Android 13 上同样工作,您还需要在运行时请求 POST_NOTIFICATIONS 权限! See the documentation for the changes that came with Android 13.有关 Android 13 附带的更改,请参阅文档。
Adding a Manifest.permission.POST_NOTIFICATIONS
ALSO to your existing permissions request should solve the problem.将Manifest.permission.POST_NOTIFICATIONS
ALSO 添加到您现有的权限请求应该可以解决问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.