Android Question Push notification banner alert

paiac66

Member
Licensed User
Hi, it's possible to display alert notification (over status bar) for push notification?
I was installed my app on huawei P8 but, when notification arrived, the system show only the icon on status bar, while no alert (popup) is showned...
I do not know if there is an option in the file manifest.xml, does anyone know?

Thanks in advance.
Paolo
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You need to create a high priority notification (on the Android device). This is done with NotificationBuilder library:
B4X:
Sub fm_MessageArrived (Message As RemoteMessage)
   Log("Message arrived")
   Log($"Message data: ${Message.GetData}"$)
   Dim nb As NotificationBuilder
   nb.Initialize
   nb.SmallIcon = "icon"
   nb.Priority = 2 'max priority
   nb.ContentTitle = Message.GetData.Get("title")
   nb.ContentText = Message.GetData.Get("body")
   nb.setActivity(Main)
   nb.Notify(1)
   Log(Message.SentTime)
End Sub
 
Upvote 0

paiac66

Member
Licensed User
You need to create a high priority notification (on the Android device). This is done with NotificationBuilder library:
B4X:
Sub fm_MessageArrived (Message As RemoteMessage)
   Log("Message arrived")
   Log($"Message data: ${Message.GetData}"$)
   Dim nb As NotificationBuilder
   nb.Initialize
   nb.SmallIcon = "icon"
   nb.Priority = 2 'max priority
   nb.ContentTitle = Message.GetData.Get("title")
   nb.ContentText = Message.GetData.Get("body")
   nb.setActivity(Main)
   nb.Notify(1)
   Log(Message.SentTime)
End Sub

Hi Erel, thank you for your reply. On my device (huawei p8) your solution does not work, I must enter in the app settings and to able "show banner" on the notitications parameters.
There are some options to activate in the manifest file for activate this option (banner) automatically?

Thanks in advance
Paolo
 
Upvote 0
Top