简体   繁体   English

如何让我的 ForegroundService 在 Android 13 上显示通知?

[英]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.

相关问题 如何向我的新闻应用 ANDROID 添加通知? - How can I add notifications to my news App ANDROID? 如何使我的Android SwipeableCardViews更像IOS 7邮件应用程序(滑动以显示按钮) - How can I make my Android SwipeableCardViews more like the IOS 7 mail app (swipe to show buttons) 如何让我的JPanels / JFrame实际出现? - How can I make my JPanels/JFrames actually show up? 如何在 android 的另一个屏幕上显示过滤后的数据? - How can i show my filtered data on another screen in android? 应用程序关闭时如何显示通知? - How i can Show notifications when app is close? 我的按钮不工作,我怎样才能让它在 android studio 上工作? - My button is not working, how can i make it work on android studio? 如何使我的Android应用程序的按钮时尚 - How can I make the button stylish for my android app 如何使我的Android对话框全屏显示? - How can I make my android dialog fullscreen? 如何修复我的Android Studio IDE? (错误23,24;错误26,13,缺少类和渲染问题) - How can I repair my Android Studio IDE? (Error 23,24 ; Error 26,13 , missing classes and render problems) 如何让我的按钮单击显示与我的随机 TextView 对应的 ImageView? - How can I make my button click show an ImageView that corresponds with my randomized TextView?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM