Why doesn't CLLocationManager fail when Airplane Mode is switched on? - ios5

I have a service class that is CLLocationManager's delegate. If I run the app, then open the Settings App and switch on Airplane Mode, my delegate gets nothing from CLLocationManager.
I would expect locationManager:didFailWithError to be called, but it is not.

Well it appears that it is possible to switch on Wi-fi while in Airplane Mode. Wi-fi is initially switched off when airplane mode is switched on, but you can switch it back on from the Settings App. This means that LocationServices are not necessarily disabled as they can still work using Wifi networks for positioning.

Related

GSEventLockDevice couldn't Lock phone properly

I locked the iPhone by calling the method GSEventLockDevice()from GraphicsServices.framework. It's working fine on the iPhone , but after locking the phone the backlight doesn't turn off. It remains lit and it shows the unlock screen.
How can I make the screen turn off immediately after locking?
Why are you doing this. Apple never accept this kind of private framework tasks. It must be jailbreak app. GraphicsServices.framework not deals with backlight and screen ON and OFF state. it just deals with GSEvents and other graphical things. I think you can't do that .
If you are developing for a jailbroken phone you could use GSEventSetBacklightLevel(0); to dim the brightness level.

Enable LED Torch for IOS App Alerts (Without enabling in iPhone System Settings)

So here's my problem: I have alerts come from my app fairly often. I've made it so they have a custom ring and vibration for when the alerts come. I want to be able to make their LED light flash on alerts as well.
I've set it up so that if these alerts come when the app is in the foreground, the LED flash and ring/vibrate work perfectly fine. However, if an alert comes when the app is in the background, I am only able to have the ring/vibrate work.
I don't want the user to have to enable it in the iPhone system settings to get LED flash alerts from all apps. I have used the inAppSettingsKit and added a settings preference for whether or not the user wants LED flash alerts. But even though my LED alert methods are called in the background, the LED does not actually flash. Is this because Apple does not allow you to control the LED unless your using it in the foreground? Does anyone know of a workaround?
Here's the simplest part of where I have it turned on and off. I control this with different timers and notification methods. The timers and notifications are called in the background the same way they are in the foreground, however the LED just doesn't turn on in the background.
AVCaptureDevice *torched=[AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
[torched lockForConfiguration:nil];
[torched setTorchMode:YES];
[torched setFlashMode:YES];
[torched unlockForConfiguration];
Thanks!

Simulating a phone call interruption in the iPhone simulator

I want to see what happens to my application if it is interrupted by a phone call or text message. Is there a way I can test this on the iPhone simulator?
It may not help in your situation (since it doesn't work in the simulator), but activating Siri works in a similar way to a phone call, sending your application to the background and interrupting audio, so is easier to test than making a call. Siri is on iPhone 4S and above, iPod touch 5th gen, and iPad 3 and above. Just hold down the home button if you have Siri enabled.
To expand on Lewis Gordon's answer it also works for devices without Siri. If you have voice control enabled then holding the home button down will interrupt audio and resign active.
Hardware -> Toggle In-Call Status will let you test the in-call UI.
I don't know of a way to test interruptions in the simulator, but as Lewis Gordon points out, you can bring up Siri on a device — even if there's no phone.

Can Siri be disabled within an app?

I'm working an on iOS game and recently tested on an iPhone 4S. Siri activates sometimes when my thumb covers the proximity sensor. This is a feature of the 4S. Instead of holding the home button, users can put the phone to their ear to activate Siri. But in my game the activation is not intended and it interrupts gameplay.
Can Siri be disabled within an app? Is this an iPhone 4S bug?
Setting :
[UIDevice currentDevice].proximityMonitoringEnabled = YES;
Disables Siri from activating when you activate the proximity sensor. As a result although, it blacks out the screen when the proximity sensor is activated instead.
Apple deprecated support for this.
http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIApplication_Class/DeprecationAppendix/AppendixADeprecatedAPI.html#//apple_ref/occ/instp/UIApplication/proximitySensingEnabled
I'd file a bug report.
Discussion
YES if proximity sensing is enabled; otherwise NO. Enabling proximity sensing tells iOS that it may need to blank the screen if the user's face is near it. Proximity sensing is disabled by default.
This the replacement which only allows you to get notification, not disable it.
Discussion
Enable proximity monitoring only when your application
needs to be notified of changes to the proximity state. Otherwise,
disable proximity monitoring. The default value is NO.
http://developer.apple.com/library/ios/DOCUMENTATION/UIKit/Reference/UIDevice_Class/Reference/UIDevice.html#//apple_ref/doc/uid/TP40006902-CH3-SW25

How can we get the iPhone screen to stay active, instead of going into the power saving mode?

I am working on a simple game that requires UIAccelerometer without any screen tapping interaction. In the default mode, the screen goes into a power saving mode periodically. How can I make the screen to stay active throughout the entire time what the app is active?
Use [UIApplication sharedApplication].idleTimerDisabled = YES to prevent the iPhone to go to sleep-mode.