I'm working on an app - one of its main properties is to inform the app if the user is using the phone, interacting with it in any way, or even touching it!
What are the suitable sensors in iPhone that can help me to detect these things?
And how can I benefit from the sensors to make this property work?
Thanks
1 Answers
The iPhone has accelerometers, gyros, and GPS. With these, you can monitor motion of the phone, sudden shocks(like when the phone is picked up and put down), orientation, and over all motion. If outside, you can also use the GPS to pick up on motion and position (lat, long, course, speed, altitude).
When interacting with the app, you've also got touch events and multi-touch events(like using two fingers to zoom in or zoom out or rotate). Most of the 'gestures' are coded and defined by apple so you don't need to figure out the user intent, just respond to their event.
Numerous sensor monitoring apps exist... eg: http://wavefrontlabs.com/Wavefront_Labs/Sensor_Data.html
Tutorials on how to do some of this stuff :
https://www.youtube.com/watch?v=Hml2jB_Qpds
https://www.youtube.com/watch?v=Xk5cJlhePCI
https://www.youtube.com/watch?v=qY4xCMTejH8

- 2,267
- 24
- 46
-
thank you for your answer, but can i ask you question ? about "sudden shocks" case: in this case the sensor should pick it while the device locked; so the app in the background, right ? i searched a lot but i didn't find a way to make this case work .. so is there a way to pick this case while the app in background ? and thank you so mush – Rawan Feb 07 '15 at 18:18
-
So long as the app is the current app (you didn't hit home button or switch apps) but you simply allowed the phone to go to sleep or hit the power button to lock the screen, this should work. http://stackoverflow.com/questions/8716466/how-nike-gps-on-iphone-receives-accelerometer-updates-in-the-background If you switch apps or suspend the app(via the home button), the events will go to other apps so you can't also get them. Otherwise this 'newer' API will keep getting data. – LawfulEvil Feb 09 '15 at 18:54