Munadel
Munadel

Reputation: 107

Choose sounds for push notification in my app

I am working on app and need to let the user from my settings on app to choose the tone for push notification from system sounds. How to let user open system sounds and choose one for push notification?

Like whatsapp notification settings

Like this link

link

Upvotes: 1

Views: 2219

Answers (2)

Andrey Chernukha
Andrey Chernukha

Reputation: 21808

You don't have to let your server know what sound the user has selected. The notification JSON payload should contain some custom value like "push_sound" for the sound field. Every time a user selects a sound save the newly selected file into 'Library/Sounds' folder and name it "push_sound". That's it

Upvotes: -1

Logan
Logan

Reputation: 53112

Step 1: Include all possible tones in your app's bundle

Step 2: Allow user to select which tone they want

Step 3: Store that on server somewhere

Step 4: When pushing that user, include their desired sound in the package

aps : {
    alert : "Some Message",
    sound : <#userPreferredSound#>
}

Upvotes: 4

Related Questions