简体   繁体   中英

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 . However, i notice the list returned is not same as the list in system . 的列表不同。

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM