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)
Related
I am currently using openAL for audio playback in my app and having problems with the audio responding to the mute switch and audio volume controls in iOS 5.
I have set up an audio session category for ambient sound and it operates correctly pre-iOS 5.
Has anyone had any similar problems?
If you watch what happens when you click that button, you can see that it initially makes a request to a redirect script on www.angrybirds.com:
http://www.angrybirds.com/redirect.php?device=iphone&product=angrybirds&type=purchasegift
From there you are redirected to a secure url of the form:
https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/giftSongsWizard?gift=1&salableAdamId=343200656&productType=C&pricingParameter=STDQ
343200656 is the AppleID for Angry Birds.
Further you can reffer below link:
"Gift App" from inside the app
I would like to detect the status of the iPhone, such as if the screen is off (screen locked), or if the device has sound turned off.
Can an API do this, or is there any other way can do it?
Thanks vikingosegundo for helping me to edit the article,but the above is not what i want to know.
in my app, ijust want to check the device, i want to know if the iphone is sound off,and if the device is powered off(has no power). how can i know this ?
When the user locks the screen, applicationWillResignActive is called, and the app enters the "Inactive" state. Unless your app is running tasks that continue in that state (e.g. continuing to play audio) after about 20 seconds the phone will enter a sleep mode where your app is moved from inactive to its background state.
Scenario: My app is running in the background. An iPhone/iPad user launches the iPod app (or Pandora or another program that plays audio) on their device and starts playing music. My app detects that that music is now playing, and records or in some way does things with the current playing audio (like stream it to a server), all while still running in the background.
Is this possible? Can anyone point me in the right direction in the SDK on how to do this?
You can't do this. And that is that.
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.
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.