Hello,
I'm having a very strange problem here... when setting a customsound in a notification using NB6, a call from some part of code runs ... from other , no sound. Exactly the same call, but from different parts of the service code. To be sure that it's running exactly the same code, from both sectors of app I call the same sub to notify (inside the same service)... see:
The code calls: NotifyV6(param1,param2) ... from two different places of the routine. One call, custom sound ok! Other call... no sound!!!! I really don't know what is happening... crazy!
Any suggestion?
### Update...
I detected that a call to a sub in other service after the notification call is causing the sound problem ...
CallSubDelayed2(DownMediaQueue,"GetMedia",dd1)
the service that has the sub has a call to http service and a callback... maybe...
### FINAL UPDATE
The download service as a call to a classic notification when starts:
When called, besides in other channel (1), it looks to cancel the sound of the other notification generated by NB6 class... I'll try to do an approach to check the sdk version and, if greater than 21, use the NB6 class to this call also...
Thanks everybody.
I'm having a very strange problem here... when setting a customsound in a notification using NB6, a call from some part of code runs ... from other , no sound. Exactly the same call, but from different parts of the service code. To be sure that it's running exactly the same code, from both sectors of app I call the same sub to notify (inside the same service)... see:
B4X:
Sub NotifyV6(UserImage As String,NotifyText As String)
Dim Rp As RuntimePermissions
Dim Folder As String = Rp.GetSafeDirDefaultExternal("shared")
Dim FileName As String = "msgting.mpeg"
Dim n As NB6
n.Initialize("Mensagem Nexphone",Application.LabelName,"HIGH")
n.SmallIcon(LoadBitmapResize(File.DirAssets,"logonexphone8.png",24dip,24dip,True))
n.SetDefaults(False,True,True)
n.AutoCancel(True)
If File.Exists(File.DirInternal,UserImage) Then
n.LargeIcon(NativeMe.RunMethod("getRoundBitmap",Array(LoadBitmap(File.DirInternal,UserImage))))
Else
n.LargeIcon(NativeMe.RunMethod("getRoundBitmap",Array(LoadBitmap(File.DirAssets,"ic_person_black_48dp.png"))))
End If
Dim CsUri As String = CreateFileProviderUri(Folder, FileName)
n.CustomSound(CreateFileProviderUri(Folder, FileName))
Dim Notification As Notification
Notification.Initialize
Notification.OnGoingEvent = False
Notification = n.Build("Nova Mensagem",NotifyText, "", chats)
Notification.Notify(20)
End Sub
The code calls: NotifyV6(param1,param2) ... from two different places of the routine. One call, custom sound ok! Other call... no sound!!!! I really don't know what is happening... crazy!
Any suggestion?
### Update...
I detected that a call to a sub in other service after the notification call is causing the sound problem ...
CallSubDelayed2(DownMediaQueue,"GetMedia",dd1)
the service that has the sub has a call to http service and a callback... maybe...
### FINAL UPDATE
The download service as a call to a classic notification when starts:
B4X:
Dim n As Notification
n.Initialize
n.Icon = "icon"
n.Vibrate = False
n.Sound = False
n.Light = False
n.SetInfo("Baixando midia...", "", Target)
Service.StartForeground(1, n)
When called, besides in other channel (1), it looks to cancel the sound of the other notification generated by NB6 class... I'll try to do an approach to check the sdk version and, if greater than 21, use the NB6 class to this call also...
Thanks everybody.
Last edited: