Android Question [RESOLVED] Is is possible to assign a notification sound to your app other then the default.

DonManfred

Expert
Licensed User
Longtime User
i guess the app just get the mp3 from the systemsetting and set this mp3 as notification sound.
You can do the same. I guess you must; i do not know a api to set it from systemsounds.
You need to use contentresolver to get the sounds, let the user select one, get the sound, store it for later use.
Set the sound when creating a notification... That´s what i would do.
 
Upvote 0

wes58

Active Member
Licensed User
Longtime User
Hello

I was wondering is it possible to assign a system notification sound to your app, a system sound not an MP3 file. I am using NB6. There seems to be an app in the play store that does this https://play.google.com/store/apps/details?id=notificon.gsy.com.notificon

Regards

John.
I am not sure that is what you want but here is a sample to pick the sound using ringtone manager and assign this sound to the notification

B4X:
    Dim nb As NB6
    Dim uri As Uri       'ContentResolver library
    Dim rm As RingtoneManager
    rm.ShowRingtonePicker("rm", rm.TYPE_NOTIFICATION, True, "")
    Wait For rm_PickerResult (Success As Boolean, UriString As String)
    If Success Then
        uri.Parse(UriString)
        'add code to initialize NB6       
        nb.CustomSound(uri)
        ',,,,,
    End If
 
Upvote 0

Jmu5667

Well-Known Member
Licensed User
Longtime User
I am not sure that is what you want but here is a sample to pick the sound using ringtone manager and assign this sound to the notification

B4X:
    Dim nb As NB6
    Dim uri As Uri       'ContentResolver library
    Dim rm As RingtoneManager
    rm.ShowRingtonePicker("rm", rm.TYPE_NOTIFICATION, True, "")
    Wait For rm_PickerResult (Success As Boolean, UriString As String)
    If Success Then
        uri.Parse(UriString)
        'add code to initialize NB6      
        nb.CustomSound(uri)
        ',,,,,
    End If

thanks for the reply, I figured it out last night :)
 
Upvote 0
Top