PDA

View Full Version : Using Proximity Sensor in app




primedime
May 20, 2011, 08:07 PM
I want to make a push up application where you would place the phone underneath yourself and as you completed a push up it will count for you.... I used a few from the app store that did this and it works nicely... I tried looking this function up in the library but I must not be searching the correct keywords, anyone want to point me in the right direction?

Thanks!!



jnoxx
May 21, 2011, 03:03 PM
I just googled your title, and found several stuff for this..

Just observe the notification: UIDeviceProximityStateDidChangeNotification

so, i guess u know what to do now.

primedime
May 21, 2011, 03:21 PM
Thanks, I was getting a lot of articles in regards to Apple fixing the proximity sensor issues and nothing about xcode. I will do some research on this now, doesn't seem to be that difficult to implement in my app. But then again, only time will tell!

timbojill
May 25, 2011, 08:53 PM
I just googled your title, and found several stuff for this..

Just observe the notification: UIDeviceProximityStateDidChangeNotification

so, i guess u know what to do now.

What are the properties ? I want to create an apps that does A if there is no movement and B if there is movement. So in theory someone will hit a button I will tie to UIDeviceProximityStateDidChangeNotification.

jnoxx
May 26, 2011, 02:48 AM
it's not if (movement) else blah. because it's only when u put your finger on the proximity sensor it will be triggered.
If u want to check for movement, I think it's best u look at some camera apps which can figure out of something is moving. or Accelerometer or something similar.