Is it possible for an NSLocalNotification to play an audio file when the ringer switch is set to OFF?
No. NSLocalNotification must adhere to the device's real world settings.
Related
I am working on a custom iPhone alarm clock.
Some users have slept in when the device is on silent and locked.
I know that the top iPhone alarms ('Smart Alarm Clock Free', 'Living Earth', 'Rise') can manually control and increase the volume if the App is in the foreground before the user locks their device.
Does anyone know how it is possible to navigate around silent mode?
When configuring your audio session simply use the AVAudioSessionCategoryPlayback category. From the docs:
AVAudioSessionCategoryPlayback or the equivalent kAudioSessionCategory_MediaPlayback—Use this category for an application whose audio playback is of primary importance. Your audio plays even with the screen locked and with the Ring/Silent switch set to silent.
Details about the different audio session categories and how to set them can be found here.
it isn't possible. The hardware switch that turns ios to silent mode cant be overriden by ios apps
(as always jailbreak'd iPhones are excluded :D)
I'm using AVAudioRecorder and able to record voice of the user.
But how can I countinue recording the voice when the app goes to background also?
Honestly, it is allowed, you should set the key UIBackgroundModes's value to audio in the application's Info.plist file.
Is the only way to vibrate an iphone using the AudioServices?
If so, why was it run through Audio to vibrate the device?
One usually associates vibrations synonymous with audio/alerts (System Alerts, Text Messages, receiving a call). As this is done through the Audio Services it makes sense to also be able to make the phone vibrate this way.
why was it run through Audio to vibrate the device
Just to point out, it's not vibrating the device using the soundwaves made by playing audio.
My app is able to play audio in the background. However, I'd like for it to not play audio in the background by default. I'd like to have a user preference which controls whether audio is played in the background or not.
Background audio is controlled via UIBackgroundModes info.plist. If I use this setting to allow background audio, my app will always play audio in the background. Is there a programmatic way to display playing audio in the background? Or do I need to do something less graceful, like fading audio in and out on my own when the app enters or leaves the background state?
Either depend on the Settings app, or provide the user a way in your app to set this preference, before your app is put in the background. Then continue to play or cut the sound depending on that setting, assuming you have set UIBackgroundModes to give your app the option.
You can easily play sounds and record sounds using the high level AVAudioPlayer. And you can play sounds using the same framework, while the iPhone screen is locked. Can you record sounds at that time?
Yes, of course, just set correct category....................................................................................................................................
""AVAudioSessionCategoryRecord
For recording audio; this category silences playback audio. Recording continues with the screen locked.
Available in iPhone OS 3.0 and later.
Declared in AVAudioSession.h.
AVAudioSessionCategoryPlayAndRecord
For recording and playback of audio—simultaneous or not—such as for a VOIP (voice over IP) application.
This category silences audio from other applications, such as the iPod. You can, however, modify this category to allow mixing by using the kAudioSessionProperty_OverrideCategoryMixWithOthers property. Your audio continues with the Ring/Silent switch set to silent and with the screen locked.