//I have created below snippet to let the sensor to be detected.
-(void)addProximitySensorControl {
UIDevice *device = [UIDevice currentDevice];
device.proximityMonitoringEnabled = YES;
BOOL state = device.proximityState;
if(state)
NSLog(@"YES");
else
NSLog(@"NO");
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(proximityChanged:)
name:@"UIDeviceProximityStateDidChangeNotification"
object:nil];
}
In the iPhone 3GS or earlier proximityChanged: method is called successfully but in iPhone 4 while I am hovering object from upwards the sensor(screen) its not being detected. Any idea Guys?