如何检测接近传感器?
How to detect Proximity Sensor?
如何检测用户是否在附近听到此音频?
首先使用iPhone Proximity Sensor检测接近传感器的状态
然后使用 phone 呼叫扬声器 Play audio through upper (phone call) speaker
播放音频
[[UIDevice currentDevice] setProximityMonitoringEnabled:YES]
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(sensorStateChange:)
name:@"UIDeviceProximityStateDidChangeNotification" object:nil];
如何检测用户是否在附近听到此音频?
首先使用iPhone Proximity Sensor检测接近传感器的状态 然后使用 phone 呼叫扬声器 Play audio through upper (phone call) speaker
播放音频[[UIDevice currentDevice] setProximityMonitoringEnabled:YES]
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(sensorStateChange:)
name:@"UIDeviceProximityStateDidChangeNotification" object:nil];