Android Question NB6 File Provider

Apip Bayok

Member
Hi,

I have some issues with NB6 Custom Sound,
I use File Provider class module that is required for some features with this code below in the manifest editor
File path in File Provider Class Module:
CreateResource(xml, provider_paths,   
   <files-path name="name" path="shared" />   
)

but NB6 Custom Sound example source code is a little bit different
NB6 Manifest:
CreateResource(xml, provider_paths,   
   <external-files-path name="name" path="shared" />
)

when I use <files-path name="name" path="shared" /> NB6 custom sound did not play the sound, otherwise
if I use <external-files-path name="name" path="shared" /> it's ringing but my other function not work.
I put it together the result is sound ringing but another function is failed and my app is force close.

I attach the project sample.
Help, please.
 

Attachments

  • sample.zip
    33.3 KB · Views: 44

Erel

B4X founder
Staff member
Licensed User
Longtime User
You should change the folder to:
B4X:
Private Sub createNotif_Click
    Dim n As NB6
    Dim folder As String = Provider.SharedFolder '<====
    Dim FileName As String = "sms.mp3"    
    File.Copy(File.DirAssets, FileName, folder, FileName)
    n.Initialize("custom sound2", Application.LabelName, "HIGH").SmallIcon(smiley)
    n.SetDefaults(False, True, True)
    Try
        n.CustomSound(Provider.GetFileUri("sms.mp3"))
    Catch
        Log(LastException)
    End Try
    Dim notification As Notification = n.Build("Testing", "Custom With Sound", "Waiting", Main)
    notification.Notify(2)
End Sub
Note that I've also changed the channel id as the OS doesn't allow changes after a channel was used (unless you uninstall the app first).
 
Upvote 0

Similar Threads

Top