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";
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.
Maybe nothing illustrates that point better than 158 Marimba, otherwise known as Tri-Tone, the default iPhone text message sound.
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).
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With