Whenever I send FCM Notification, on the device I receive 2 notifications.
Whenever FCM message reaches the device, I call a Service to handle FCM Messages. For eg in firebaseMessaging Service
In the FcmNotifications service I call the NB6 as follows
Any help will be appreciated
- One is the real notification with all the content that I send. Perfect
- The second one appears with just the app name, it is not dismissable by swiping. To remove this notification, either I will have to restart the device or uninstall the app
Whenever FCM message reaches the device, I call a Service to handle FCM Messages. For eg in firebaseMessaging Service
B4X:
Sub fm_MessageArrived (Message As RemoteMessage)
' Log("Message arrived")
' Log($"Message data: ${Message.GetData}"$)
CallSubDelayed2(FcmNotifications,"ProcessNotifications",Message)
End Sub
In the FcmNotifications service I call the NB6 as follows
B4X:
Small_Icon = LoadBitmapResize(File.DirAssets, "applogo.png", 24dip, 24dip, False)
nb.Initialize("default", Application.LabelName, "DEFAULT").AutoCancel(True).SmallIcon(Small_Icon)
nb.LargeIcon( LoadBitmapResize(File.DirAssets, "applogo.png", 256dip, 256dip, True) )
'From the Message identfy the notification type
If Message.GetData.ContainsKey("NotficationTag") Then
cNotficationTag = Message.GetData.Get("NotficationTag")
End If
nb.Build(cSubject, cMsg, cNotficationTag, TheActivity).Notify(nNotificationCount)
nNotificationCount = nNotificationCount + 1
StopService("") 'Not sure whether this line is really required or not
Any help will be appreciated