Assign alert tone for UILocalNotification from available sounds in iphone - iphone

I am working on an app that used UILocalNotification. I wanted to select sound from default sounds that came with iPhone. How can i list down sounds for assign as the alert tone.

There is one standard sound for notification from system (UILocalNotificationDefaultSoundName). You can play any custom sound shorter than 30 seconds. So, if you can download any native sound from ios from anywhere, you will be able to use it as custom sound. Documentation

Related

Playing loop sound at certain time when iphone app is in background

I have a Clock Alarm app that plays sound at certain time (Sending local notifications). Is it possible to play loop sound at certain time (when local notification comes) when app is placed in background ?
Just want to specify: I need to play loop sound, not only once
No. The reason why is because you won't be able to execute any code because of a local notification. One thing you can do, and it's totally up to you if this is something your app really needs to di, it to list this application as an audio application on the UIBackgroundModes key of your .plist file, and just change song that is playing at the time it has to. You can use a dispatch_after block to change the song at the time you want it to.
Make your app a long running background app as described in this link here

UILocalNotification loud sound in background

Is there a way to play UILocalNotification sound loudly ignoring the volume settings? Like this happen in "Find my iPhone" app. I found some answers on this question but all they according to charge and play AVAudioPlayer - which is not correct. We are not able to get the event of UILocalNotification appearing and try to play the sound from another source like AVAudioPlayer. We got the event in AppDelegate when user press "OK" button. So is ther a way to play loud sound by UILocalNotification itself?
No. If your app is running in the foreground, you can use application:didReceiveLocalNotification: and programatically play a sound. Otherwise, you're limited to the options in the UILocalNotification API, which is limited to a very specific set of options and does not let you set the sound volume.

iPhone playing sounds while in the background

I have a small application which is much like a clock. It has been working great on IOS3, but now I am updating it to iOS4.
What I want to do in iOS4 is to let it play a sound any giving time. For instance, if I set it to play at 4.00 PM I want it to play a sound, a sound from the application not from the OS. This works if the app is launced, but if the user went back to the home screen I want the same to happen.
It is OK if a UIAlertView pops up istead of the application.
How can I do this?
Best regards,
Paul Peelen
Sounds like you'll need to use a local notification:
http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction/Introduction.html
and
http://developer.apple.com/iphone/library/documentation/iPhone/Reference/UILocalNotification_Class/Reference/Reference.html#//apple_ref/occ/cl/UILocalNotification
Read http://developer.apple.com/iphone/library/documentation/iphone/conceptual/iphoneosprogrammingguide/BackgroundExecution/BackgroundExecution.html.
What you want is UIApplication setKeepAliveTimeout:handler: which let you register a handler that will be called. You can use that to start playing audio. (Of course, compute the timeout when your app goes to background)
EDIT: Use UILocalNotification as andy said.
Two things you could possibly try under iOS 4.
Local Notifications can pop up an alert and play a short sound.
Another power hungry option is to register as a background music player, and play silence until time for the alarm to go off, then add your chosen sound to the "music" output. This will fail if the user switches to another media player app.

Anyone know if it's possible to use custom sounds on the iTouch piezo speaker?

I'm obviously not trying to play full spectrum audio, but is there some way to customize the iPhone/iTouch system alert sounds to play a little melody on the piezo speaker? The functionality is clearly present, so I guess the question is has Apple made it available for developer use...
Thanks,
-S
There are quite a few predefined sounds you can use in the 0-2000 range. For example, the keyboard click can be called like such:
AudioServicesPlayAlertSound(1104);
There is also a way to play a custom melody on the first-generation iPod touch, but it's not pretty.
It isn't. Sorry.
Only thing you can do from an application is this (you can use any SoundID for this, really):
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
Discussion
Depending on the particular iPhone OS device, this function plays a short sound and may invoke vibration. Calling this function does the following on various iPhone OS devices:
iPhone—plays the specified sound and, if the user has configured the Settings application for vibration on ring, invokes vibration.
iPod touch, original—plays a short alert melody.
iPod touch, 2nd generation—plays the specified sound.

Limits on iPhone push notification sounds?

Does anybody know of any limitations on the sounds that can be played when an iPhone app receives a push notification? Specifically, is there a maximum sound length?
Also, I am assuming that the volume of the sound will match whatever the user has set their ringer volume to, and if set to vibrate mode, the phone will vibrate instead of playing a sound. Is this correct?
I have tested the maximum length of a push notification audio alert, which not surprisingly turned out to be 30 seconds. Any longer audio files will result in the built-in Tri-tone alert being played instead.
I don't know for sure, but based on various API limitations I would guess the length would be 30 sec. max. And yes, the volume of the ringer is the volume of the sound. Same with vibrate mode
You may have to consider "Notification Payload" for that.You can also have Custom Alert Sounds.
See this:Notification Payload
Updated reference to Apple's documentation for 30 seconds.
https://developer.apple.com/library/prerelease/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/SupportingNotificationsinYourApp.html#//apple_ref/doc/uid/TP40008194-CH4-SW10
Here's the reference in Apple's documentation (30 seconds is correct): https://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/IPhoneOSClientImp/IPhoneOSClientImp.html#//apple_ref/doc/uid/TP40008194-CH103-SW6