英文:
Android 10 app notifications not working after an upgrade from only testing android 7
问题
我用Java制作了一个安卓应用,在我的旧设备上运行良好,该设备运行的是Nougat(安卓7)。我最近换了一部运行安卓10的新手机,整个应用运行得很好,只是创建通知出现问题。为什么会出现这种情况?我该如何解决?提前谢谢。
英文:
I made an android app in java and it worked on my old device that ran nougat (android 7), I recently got a new phone that runs Android 10, and the entire app works just fine, except for creating a notification.
Why is this happening? and how do I fix it?
Thanks in advance.
答案1
得分: 1
从 Android 8 开始,所有通知都必须有一个通知渠道:
https://developer.android.com/training/notify-user/channels
当您的应用尝试并且未能显示通知时,您应该会收到一个包含确切信息的堆栈跟踪。
英文:
Starting in Android 8, all notifications must have a notification channel:
https://developer.android.com/training/notify-user/channels
You should get a stack trace that says exactly this when your app tries and fails to show a notification.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论