Using Proximity Sensor in app

Discussion in 'iOS Programming' started by primedime, May 20, 2011.

  1. primedime
    Expand Collapse
    macrumors member

    Joined:
    Mar 21, 2011
    Location:
    Ft. Lauderdale, FL
    #1
    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!!
     
  2. jnoxx
    Expand Collapse
    macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #2
    I just googled your title, and found several stuff for this..

    Code:
     Just observe the notification: UIDeviceProximityStateDidChangeNotification
    so, i guess u know what to do now.
     
  3. primedime
    Expand Collapse
    thread starter macrumors member

    Joined:
    Mar 21, 2011
    Location:
    Ft. Lauderdale, FL
    #3
    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!
     
  4. timbojill
    Expand Collapse
    macrumors member

    Joined:
    May 21, 2011
    #4
    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.
     
  5. jnoxx
    Expand Collapse
    macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #5
    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.
     

Share This Page