Android 10应用通知在从仅测试Android 7升级后不起作用。

huangapple go评论75阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2020年9月2日 12:43:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/63698827.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定