Total screen unlock time calculation in iOS - ios

For my current project, I need to calculate the total time while an iOS device is unlocked i.e. the user is working on his device. I am aware of the Darwin Notifications as available in CFNotificationCenter as specified in this Stackoverflow question. I have tested this code on my iPhone 5C. It is woking fine for foreground mode. But I am not able to receive those notification when the application is in background mode. Is it possible to receive those notification in background mode? Or is there any other way to calculate total unlocked time for a device from my app even when the application is in background mode?

As explained here. Background mode can only be used for specific purposes. If your App is not using background mode for any of those purposes (which it isn't), it will not work.
In short, it could only work on a jailbroken device.

Related

How to determine number of locks and unlocks of iPhone programmatically

is it possible to determine how many times my iPhone has been locked and unlocked programmatically when app is foreground and background as well. Code snippet will help a lot...
There's no way to get this information from your App.
You can only know when your app goes to foreground/background via your App Delegate, but not what the user does outside of your App.

Put Mobile App Launch Icon on Notifications Screen to Launch from Locked Device

Want to put the icon for our iOS app on the iOS Notifications Screen that can be accessed when a user has not entered their passcode, so that the user can launch the app when the phone is locked without needing to input their passcode. The goal is for a very fast launch with minimum time from a locked iphone. We don't need to actually send the user a notification. Would also be great for this to work on Android, but iOS is currently more important for this feature.
What is the best way to do this using Cordova? Is there an existing plugin for this purpose?
Thanks
It is not possible to launch an iOS app without unlocking the phone/device. The notifications screen is only available once the iOS device is unlocked.
(thanks to dan)

iOS detecting photo capture from default camera app in your app from background

I want to be able to detect the camera capture event that happens from the default iOS camera app when my app is running in the background to do some processing.
I have seen Facebook Moments doing it. It throws notifications on capture after being in the suspended state for hours well after the 180 seconds that Apple allows any app to stay active at max after being put in background. Also they don't take location permissions. They don't do it based on silent APNS because it works without internet as well.
I have already explored PhotoLibraryChangeObserver in the Photos.framework but it works only when the app is brought into foreground.

Xamarin - iOS backgrounding with BT low Energy and TTS

I'm working on a proof of concept app. I'm using Xamarin for iOS. The iPhone app runs in the background and watches for particular BTLE devices and speaks using TTS when the signal is at a certain strength. I have TTS working and I can recognize the BTLE devices when the app is in the foreground.
However, I'm having trouble getting either working when the iPhone screen is off. In Android, I'd just use a wake lock, but that appears to not be available in iOS. I tried setting the background modes in the info.plist file for BTLE and sound, but I don't see any processing happen while the unit is suspended. Can anyone point me in the right direction?
This is just a proof of concept, so I'm only looking at the latest iOS version and I'm interested in even hacky answers.
Thanks!
You will need to create at least one background task UIApplication.SharedApplication.BeginBackgroundTask and end it with EndBackgroundTask when you finish transferring your data.
Note that you will have approximately 10 minutes in background. If user switch back to the app the time will be reset.
You might also want to disable application idle timer to prevent the screen to go black when the user doesnt touch it.

Launch app from background service

I've developed Android app which has a background service in the sleep mode. This service works with accelerometer data and can launch the app from the sleep mode over the lock screen.
Is it possible to make the same on iOS?
I mean:
Create a service which can work in background with accelerometer data.
Service can launch the app when the phone is in the sleep mode over lock screen. (without unlocking)
If I'm not mistaken it must be possible on iOS7, isn't it?
Thanks!
Yes – Apple publicly stated background processing at WWDC keynote and it can be done to a degree on iOS6
No – Apple will 'probably' never allow an app to be opened without the user instigating it and certainly not over the lock screen.
You could use Push / Local Notifications which do appear on the lock screen to try and entice a user at a specific time to launch the app but no guarantees.

Resources