Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Proximity sensor on when hand move around Sensor.

jitendrajitendra Posts: 59New Users @

I am developing one app in that i want to get the proximity sensor on when user move hand around proximity sensor and get proximity state value like 0. when user move hand second time value get 1 how may i do this i know how to enable proximity but i want to enable proximity when user move hand around proxy. so how may i do this i tried this code. to enable proximity.

UIDevice * device=[UIDevice currentDevice];
device.proximityMonitoringEnabled=YES;

if (device.proximityMonitoringEnabled)
{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleProximityChange:)
name:UIDeviceProximityStateDidChangeNotification
object:nil];
}
else
{
NSLog(@Device not capable to support Proximity sensor);
// device not capable
}

and catch the proximity state in this method...

-(void)handleProximityChange:(NSNotification *)notification
{

NSLog(@Proximity event catch);

}

i will do this code as per user hnd over in proximit so hoe may i do this please help me to do this.

Replies

  • Duncan CDuncan C Posts: 9,116Tutorial Authors, Registered Users @ @ @ @ @ @ @
    Is there a coherent question in there somewhere? I can't see it.

    As far as I can tell, you're asking how to activate the proximity sensor when the user waves his hand in front of the proximity sensor. That doesn't make sense. If the proximity sensor is off, it can't detect proximity. If it's already active, it's already active.

    Stop, take a deep breath, and think about what you are trying to do. Then think about how to describe what you want to do. Then write a short, coherent description of what you want to do. Use actual, grammatical sentences with capital letters and punctuation. Then proof-read your description. Will it make sense to somebody who's reading about your problem for the first time? If no, edit it until it does make sense.

    I'm not being a grammar Nazi here. Your post is truly unintelligible.
    Regards,
    Duncan C
    WareTo

    widehead.gif
    Animated GIF created with Face Dancer, available for free in the app store.

    I'm available for one-on-one help at CodeMentor
Sign In or Register to comment.