--jpProximity API jpProximity.activate ( sUserToken, sActivationKey ) bProximity = jpProximity.getProximityState ( ) bEnabled = jpProximity.isProximityMonitoringEnabled ( ) bAvailable = jpProximity.isProximitySensorAvailable ( ) jpProximity.setProximityMonitoringEnabled ( bEnabled ) --User notification events: "onProximityStateDidChange" ( bProximity )
Ask for the state of the proximity sensor and get notified when the state changes. It automatically turns the screen black when the proximity state is 'true'