iOS 7.1: Get Core Motion data (accelerometer, gyroscope) while app is in background - ios

I am wondering how I can keep receiving motion sensor values while the app is in background mode. I realize that there are already several posts out there. For example, I have tried How Nike+ GPS on iPhone receives accelerometer updates in the background? which does not work for me.
I have also enabled background modes (location updates at the moment) in my App-Info.plist.
Are there any working examples out there? Also, if possible, I would not want to implement some of the hacks, e.g. play silent audio or get the user's location. Apps such as SleepCycle seem to be able to have achieved this without any workarounds.
I'd be grateful for any help.

Related

invoke a alarm sound when ios app is in background and someone pick it, using core motion

invoke a alarm when someone touched the iPhone or iPad and a app is running in background.
this is happening into a ios app i.e. iAntiTheft
iAntiTheft is not using the location i checked the permission of the app, in a scenario i put the app in background activating motion alert and device get's locked after some time, now i pick the device, it immediately show a Notification and start alarm on high volume.
one More thing here to notice it always playing a low volume beep beep after enabling the motion sensor alert. any help appreciated.
how can i achieve this.
The answer to get Core Motion Update when the app is in background and the device locked. in both case just put an audio with background mode playing after the core motion updates function, now the device will go to background or get locked you always getting the core motion coordinates updates
Repo Link Providing soon

How to continue collect motion sensor data on apple watch?

I'm developing an app on apple watch which needs continuous access to gyroscope and accelerometer data. But once the watch rotates, the screen turns off and apparently it stops accessing motion data while the screen is off. I tried to keep the screen on but apple watch doesn't have that feature, any thoughts around this?
Thanks
You'll need to start an HKWorkoutSession.
The app can continue to access data from Apple Watch’s sensors in the background, letting you keep the app up to date at all times. For example, a running app can continue to track the user’s heart rate, ensuring that the most recent heart rate data is displayed whenever the user raises their wrist.

ios app, running accelerometer while the app is in the background

I have an app using accelerometer. When a certain motion is detected, i am trying to make my iphone vibrate. While the app is in the foreground, and I conduct a certain motion, it vibrates. But it does not when the app is in the background.
I have a counter that detects this motion. When I execute this motion while in the background for three times, although it does not emit any vibration, after I transition back to foreground, the counter is increased by three. So I know the accelerometer is working. Or is putting the motions in a queue and executing it when the app comes back to foreground.
And I'm not making a rookie mistake by touching the phone's vibrate to off.
I'm quite not sure where to go from here. Is iphone inherently not capable of capturing and processing accelerometer data while in the background? Or is there something I'm not doing correctly?
In iOS there are only a certain type of activities allowed in background. Here you can check them: Background Modes.
I'm currently working in an app that uses sensors like the accelerometer and I get updates from it using the CoreLocation delegate method didUpdateLocation, since using the GPS to locate the device is one of the Apple allowed background modes. I hope this helps you!

iOS check if camera is obscured or not

I need to check periodically if the camera is obscured or not.
I was thinking of doing this by taking pictures periodically and checking them for brightness, if there is any way to let an App take pictures while the App is in background. Apple does this within it's Find my iPhone system, as I've read (taking randomly/secretly photos of the thief). Is there any way of achieving this within an own App?
Or do you have any other idea how to achieve this?
Not in any way while your app is in the background. Here's a list of services allowed while the app is in the background.
You can only, sort of, check the luminosity while your app is active by calculating it from the images you take. Apple does not allow access to the light sensor to apps yet.

iOS: Detect screen on/off events

I'm trying to detect screen on/off events from a background service on iOS.
Because my app is not necessarily in the foreground, looking for app lifecycle events such as this aren't any use:
Lock Unlock events iphone
The best solution I've got so far is to search through the system logs, looking for Springboard events. Problem is, it's a pretty expensive operation, and requires regular polling which is a waste of battery. The solution needs to work on non-jailbroken devices but doesn't necessarily need to be app-store approved.
Can anyone suggest something better?

Resources