Prevent iPhone auto-lock, but permit screen dimming - ios

I have an application which works in a hands busy environment so the user rarely touches the device. Of course, the phone goes into auto-lock and my app stops working. I used this code:
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
to prevent the device and that is fine. However, I would still like the screen to auto-dim. The above code keeps the screen from auto-dimming as well as auto-locking.
This question shows me how I can dim the screen manually, and that just may be a good enough solution. But I'd rather use system settings, not app settings.
So how can I prevent auto-lock while still getting the auto-dim?

Related

How do I prevent iOS device from locking while on a particular screen?

My app includes a 'Sleep Mode' that is initiated by pressing a button on the main screen. While on this screen I want to prevent the phone from locking automatically but still allow auto dimming. If the user leaves the app by manually locking their device or pressing the home button they should be able to navigate back to the app and have their device remain unlocked. What is the best way to accomplish this in objective-c?
You can add the following code to prevent device getting auto locked
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];

How to lock Iphone to a specific screen of app for some time, same like kids mode programmatically?

I am developing an app in which user gets alerts for Quran time. Now when user is in prayer i want to lock my device for that time same like enabling kids mode. How that can be achieved in iPhone.
Apple hasn't released any kind of Public API to do so. And I'll never recommend to use the Private API's (if available in this case), cause it's could lead to reject your app.
In my knowledge I only knew how to prevent the phone from locking while your app is running.
Objective-C
[UIApplication sharedApplication].idleTimerDisabled = YES
Swift
UIApplication.sharedApplication().idleTimerDisabled = true
You can add treatment for this inside the app, but unless the device is jailbroken, you cannot prevent the user from pressing the device's home button and leaving your app.
If you just want the user to stay on a specific screen of your app, you can disable user interaction (either by setting userInteractionEnabled = NO on the main ViewController's view, or by adding a transparent UIButton that will cover the entire screen, catch the presses and do nothing with them, as long as the payer is in session). You can also keep the screen from locking for that duration of time by using:
[UIApplication sharedApplication].idleTimerDisabled = YES;
And setting it back to NO when the prayer is done (only if you choose to).
However, the user will still be able to leave the app by using the device's physical home button that will take him back to the home screen.

LibGDX displays black screen while app is paused but still visible (e.g. during in-app purchase password dialog) on iOS

I converted one of my apps over to LibGDX.
In the earlier version, when I launch an in-app purchase and iOS shows the dialog to ask the user for their password, my app would stay visible and running (animations would update) in the background behind the dialog.
After the switch to LibGDX (and no other changes regarding purchasing), the app now disappears and the background behind the password dialog is just black. Right before this happens, LibGDX reports [debug] IOSApplication: paused and right when my app comes back to life, I get the message [debug] IOSApplication: resumed.
Is there any way to have LibGDX keep updating my app's screen while it's paused (preferably only if it is still partially visible, though), or at least keep displaying the last drawn frame rather than switching to black?
PS: I have continuous rendering turned off.
I found a way to fix the problem: Get rid of LibGDX.
Here's how: https://stackoverflow.com/a/35094695/1217178
Disclaimer:Clearly this isn't a true answer to the original question, but unfortunately I don't have the time to go hunting for bugs in libGDX, especially since my app is almost 1MB (15%) smaller and starts faster without it, too. But if someone else comes across this issue and figures it out, please do post your answer and I will accept it instead of this one.

Lock and unlock screen - iPad

Would it be possible to lock a device screen and unlock it again? The reason I would want to do this is we have a kiosk type app and we would like to turn of the screen between certain times.
I would think a type of push notification would be needed?
Once iPad is locked you're not going to be able to unlock it programmatically, even through a push notification. Assuming these devices are always plugged in you may be better off turning off the idleTimer (which I'm assuming you already have) then invoke some sort of screen save or idle screen that displays during those hours. That way your app never allows the iPad to lock natively and you can control when clients do & don't see the content.
That brings up a design question, though... what happens if someone is present when the idle screen is up? Should you override or keep it on the idle screen? Just thinking out loud.

Location Services still running after app is killed

I am seeing an issue with Location Services still being used by my app even if the app has been killed from the multitasking bar. If I go into Settings > Privacy > Location Services I notice that my app has a purple location icon even while there are NO apps in the background. If I turn off Location Services for my app, the icon in the status bar disappears.
I have ensured in my app that I am stopping location services when they are not needed. I have verified this numerous times in Instruments. GPS turns on when it is supposed to and when the task is finished using location services, the GPS is turned off.
In my applicationWillTerminate: delegate, I even set the lcoationManager to nil, set the delegate to nil and make sure all of that is cleaned up. I still see the icon in the statusbar when I KILL my app.
This particular app also has a bluetooth accessory that can make the app do certain things. So for instance, I press a button on my BLE accessory and it makes the app do something which will trigger a UILocalNotification, so I see a banner. I don't know how to reproduce this particular issue, but I've noticed that even if there are NO apps in the multitask bar and I press the button on my BLE accessory, it will trigger the action in the app and I will see the notification banner.
A few questions:
Has anyone else seen anything like this?
How can I ensure that my app is COMPLETELY killed even though I have cleaned up really good on application terminated?
Why would the location services still be running even though the app is killed. Also keeping in mind that I do NOT use any region monitoring or significant location update changes.
Update:
So I took a previous version of the app and reset Location & Privacy settings and to my surprise, backgrounding the app makes the location icon disappear (as it should have been doing all along. To me this means that iOS is keeping some residual information or settings from the app? Anyone have any insight as to what could be going on here?
Update 2:
Still occurs in iOS 8.1.x.

Resources