我想获得SensorManager的实例。我应该在下面写什么而不是SENSOR_SERVICE?如果它是已注册服务的名称,那么向Manifest.xml添加什么?
mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
我一直在使用这里的代码:http://developer.android.com/reference/android/hardware/SensorManager.html
EDIT:没有这样的方法:getSystemService(....);
EDIT2:这能行吗:ctx.getSystemService(Context.SENSOR_SERVICE);
发布于 2014-07-06 00:10:04
所有的上下文都有这个功能。您需要在上下文类(Activity或Service)中调用它,或者在对一个类(context.getSystemService())的引用中调用它
https://stackoverflow.com/questions/24588220
复制相似问题