This is a short question but it was bugging me for a whole night. I have few of my own applications here (I write Objective-C Only and I use ARC) where if I write in appDelegate - application didFinishLaunching...:
[[UIDevice currentDevice] setProximityMonitoringEnabled:YES];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(proximityStateChanged:) name:UIDeviceProximityStateDidChangeNotification object:nil];
I get perfectly normal response. Display turns off, I get notification with changed proximityState, etc.
Now, I have application that is not mine and I should modify it (I have Xcode project - source files). I only should implement some changes based on proximitySensor. I am absolutely unable to enable proximityMonitoring? I am doing the same thing as in other applications but it is simply not calling the notification and not changing proximityState. Biggest difference is that this application's appDelegate is .mm - mixed language, but I really don't think this should be a problem.
Is there some GLOBAL way to disable sensors or only proximity sensor? Can some service for recording audio or playing audio be able to disable proximity sensor? Any clue would be golden! I really don't understand what could be preventing me from enabling this feature. Cheers everyone.
FUU!
ProximitySensor is being disabled if the application doesn't support Portrait orientation! You can do whatever you want, but if Portrait is not checked as a Device Orientation, ProximitySensor wont start up!