I have problem with app sound when arrived a push and show the notification
The sound is not always played, one time yes, one time no, ecc,ecc.
Why?
Thanks
The sound is not always played, one time yes, one time no, ecc,ecc.
Why?
Thanks
B4X:
sub Process_Globals
Private fm As FirebaseMessaging
Dim NotifSound As SoundPool
Dim NotifID As Int
End Sub
Sub Service_Create
fm.Initialize("fm")
NotifSound.Initialize(2)
NotifID = NotifSound.Load(File.DirAssets, "notification.ogg")
End Sub
Sub fm_MessageArrived (Message As RemoteMessage)
Dim n As Notification
n.Initialize
n.Icon = "notification"
n.Sound = False
n.Vibrate = False
n.Light = False
n.OnGoingEvent = False
n.AutoCancel = True
n.SetInfo(Message.GetData.Get("title"), Message.GetData.Get("body"), Message.GetData.Get("activity"))
n.Notify(1)
NotifSound.Play(NotifID, 1, 1, 1, 0, 1)
end sub