Android Firebase Notifications suddenly using default icon and displaying notification title instead of notification message - S

Up until very recently, when my app sent notifications to Androids, the receiving phone would get our c

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
Add a comment  | 

1 Answer 1

Reset to default 0

It 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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745172301a4615000.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信