Android Sensor.TYPE_接近返回空值,即使存在有效的接近传感器

Android Sensor.TYPE_接近返回空值,即使存在有效的接近传感器,android,proximity,Android,Proximity,我正在编写一个测试应用程序来验证三星Galaxy Note 10.1平板电脑(仅限Wifi)上的接近传感器功能。根据设备规范,它支持接近传感器。然而,当我查询设备上支持的传感器时,它不会返回接近传感器,因此传感器类型的传感器。type_-approxity为空。除了使用这个类,还有其他方法验证邻近功能吗?想知道当设备规范明确表示支持接近传感器时,为什么会返回null 相关代码: mSensorManager = (SensorManager)getSystemService(Context.SE

我正在编写一个测试应用程序来验证三星Galaxy Note 10.1平板电脑(仅限Wifi)上的接近传感器功能。根据设备规范,它支持接近传感器。然而,当我查询设备上支持的传感器时,它不会返回接近传感器,因此
传感器类型的传感器。type_-approxity
为空。除了使用这个类,还有其他方法验证邻近功能吗?想知道当设备规范明确表示支持接近传感器时,为什么会返回null

相关代码:

mSensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE);
mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY); //This returns null
List<Sensor> sensorList = sensorManager.getSensorList(Sensor.TYPE_PROXIMITY); //returns null
mSensorManager=(SensorManager)getSystemService(Context.SENSOR\u SERVICE);
msSensorManager.getDefaultSensor(传感器类型_)//这将返回null
List sensorList=sensorManager.getSensorList(传感器类型\u)//返回空值

我不认为你有接近传感器。如果您这样做了,那么在实现SensorEventListener之后尝试做一些事情。我的平板电脑也面临同样的问题,最后我得出结论,我的平板电脑中没有邻近功能。

谢谢。是的,我确实尝试实现了传感器事件监听器,如下所示,但由于mSensor为null,因此它从未真正起作用。我的代码。你试过类似的东西吗?mSensor=mSensorManager.getDefaultSensor(Sensor.TYPE_接近度);mSensorManager.registerListener(此,mSensor,SensorManager.SENSOR\u延迟\u正常);不,事实上我没有。我暂时把注意力放在其他一些应用上一些“接近”传感器实际上只是带有动态截止的光传感器。你试过调查那件事吗?我不能说我玩过音符,但一些设备的光传感器报告近/远为简单的0/1。