Android Question NB6 Notification With CustomSound issue

hanyelmehy

Active Member
Licensed User
Longtime User
i use this code to make Notification With CustomSound
B4X:
Sub Notification_WithCustomSound
    Dim FileName As String = "short.mp3"
    File.Copy(File.DirAssets, FileName, Provider.SharedFolder, FileName)
    Dim in As Intent
    in.Initialize(in.ACTION_VIEW, "")
    Provider.SetFileUriAsIntentData(in, FileName)
    Dim n As NB6
    n.Initialize("custom sound", Application.LabelName, "DEFAULT")
    n.SmallIcon(LoadBitmapResize(File.DirAssets, "smiley.png", 32dip, 32dip, True))
    'disable the default sound
    n.SetDefaults(False, True, True)
    'set custom sound
    n.CustomSound(Provider.GetFileUri(FileName))
    Dim Notification As Notification = n.Build("Notification with custom sound", "...", "", Main)
    Notification.Notify(3)
End Sub
Notification shown but with no sound
other Notifications show correctly
i add FileProvider in Manifest
i use
B4X:
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="34"/>
 
Top