Steven
Steven

Reputation: 160

Use of iphone default alert tone

I'm try to build a messaging apps, with push notification applied. I wish to apply user defined notification tone, like whatsApps does. I notice whatsApps is using IOS default sound system, and i google around, there is a method to get system sound, by accessing "/System/Library/Audio/UISounds". However, i notice the list returned is not same as the list in system "Setting->sound".

Here is my question

1) how am i possible to get all the sound file, is good with the naming same as IOS setting.
2) If i wanted to apply those sound in push notification, do all the .caf file need to include in my apps bundle?
3) is yes, is it possible i able to download it over internet?(i've google a lot and found no luck) or any way to convert/export it?

Upvotes: 3

Views: 1212

Answers (1)

Nitin Gohel
Nitin Gohel

Reputation: 49720

you just need to set server side payload json like following:

{
    aps =     {
        alert = "Hello World";
        badge = 1;
        sound = default;
    };
}

sound = default; that alert tone apply default one

For second question yes you have to put all sound file in to your apps bundle.

And do not forget to set this following code in to your Appdelegate class when you registerForRemoteNotificationType :

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
     (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];

Here it is link for iPhone sound files list.

Upvotes: 3

Related Questions