Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I access default iOS sound to set it as notification sound?

How can I access default iOS sound (Tri-tone, Chime, Glass, Horn, Bell, Electronic...) to set it as local notification sound?

I've created local notification, everything works but with default sound (which is Tri-tone). I want to use Chime or another

I only know how to use my own sound files:

localNotif.soundName = @"sound.wav";
like image 654
user1367471 Avatar asked Aug 02 '12 11:08

user1367471


People also ask

How do I get the default notification sound?

In this case, you'll need to use an Android file manager to add the ringtone to your smartphone. Here's how to manually add a custom sound to your settings. Go to Settings > Apps & notifications > Notifications. Scroll down and tap Advanced > Default notification sound.

What is the default iPhone notification sound?

Maybe nothing illustrates that point better than 158 Marimba, otherwise known as Tri-Tone, the default iPhone text message sound.


3 Answers

check out this site.

If you want to play a Default System Sound. refer a following code, but private Frameworks. you will be rejected.

AudioServicesPlaySystemSound(1004);

and check out other this sample code (No private frameworks. supported a Apple).

like image 171
bitmapdata.com Avatar answered Oct 19 '22 18:10

bitmapdata.com


System sounds are not available you your app, unfortunately. From the docs:

Note: System-supplied alert sounds and system-supplied user-interface sound effects are not available to your iOS application. For example, using the kSystemSoundID_UserPreferredAlert constant as a parameter to the AudioServicesPlayAlertSound function will not play anything.

Update

While Apple does say you can't access system sounds, I suppose they must mean that you can't access them for your own purposes, but I see that UILocalNotification.h provides:

UIKIT_EXTERN NSString *const UILocalNotificationDefaultSoundName; 

"Identifies the default system sound to play when a notification alert is displayed. You assign this value to the soundName property." I am now using this in my app and it seems to work fine.

like image 38
Ben Flynn Avatar answered Oct 19 '22 17:10

Ben Flynn


Audio services are not private. The methods are documented in the developers reference guide and referenced in the Multimedia Programming guide.

All you need to do if figure out the reference id of the sound you want to play.

like image 2
user2212412 Avatar answered Oct 19 '22 19:10

user2212412