Android Question Notification Sound

aaronk

Well-Known Member
Licensed User
Longtime User
Hi,

I am using Firebase notifications and it's displaying the notification fine, but even knowing I have the sound set to False it's still playing the default Android notification sound.

Have I missed anything ?

B4X:
Sub fm_MessageArrived (Message As RemoteMessage)
    Log("Message arrived")
    Log($"Message data: ${Message.GetData}"$)
    Dim n As Notification
    n.Initialize

    n.OnGoingEvent = False
    n.Sound = False
    n.Vibrate = True
    n.Icon = "icon"
    n.SetInfo(Message.GetData.Get("title"), Message.GetData.Get("body"), Main)
    n.Notify(Rnd(1,999999))
End Sub

I am using B4A 8.00.
Running my App on Android 8.1.0
Target SDK 26.

I have noticed that if I initialize it like: n.Initialize2(n.IMPORTANCE_LOW)

Then it doesn't play any sound. (even if I use n.Sound = True)

Do I need to initialize it with n.initialize2(IMPORTANCE_LOW) or should my original code above worked ?
 
Top