admin管理员组文章数量:1414887
Up until very recently, when my app sent notifications to Androids, the receiving phone would get our custom icon in the notification bar, and when pulling it down, it would show what was in the "message" part under "data" (we use json messages). Now all of a sudden, many times it shows the generic Android icon, and then it shows the "title" part under notification. Did something recently change in Firebase Messaging -- say since early November?
Up until very recently, when my app sent notifications to Androids, the receiving phone would get our custom icon in the notification bar, and when pulling it down, it would show what was in the "message" part under "data" (we use json messages). Now all of a sudden, many times it shows the generic Android icon, and then it shows the "title" part under notification. Did something recently change in Firebase Messaging -- say since early November?
Share Improve this question asked Feb 21 at 0:28 fbs419fbs419 616 bronze badges 1- Even though I use FLAG_IMMUTABLE when I create PendingIntents, I still get this error: EUAlert: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Again, I haven't changed the app. Has anyone had this issue after not touching their app which used to work. It only happens when the app is in the background. It may have to do with older Firebase Messaging libraries, but I can't upgrade them because it's a Xamarin project. Is there any way around this? – fbs419 Commented Feb 23 at 17:11
1 Answer
Reset to default 0It turns out that the problem happened when notification message files were changed from Legacy to HTTP v1. The old messages were "data" messages, but the new ones were changed to "notification" messages. This caused OnMessageReceived (which builds my notifications and sets the IMMUTABLE flag correctly) not to be called when the app was in the background. By taking out:
"notification": {"title": "My TITLE", "body": ""},
from the JSON message file, OnMessageReceived would execute in all cases, and the app started working perfectly again. Posting this in case this happens to someone else.
本文标签:
版权声明:本文标题:Android Firebase Notifications suddenly using default icon and displaying notification title instead of notification message - S 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745172300a2646049.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论