1,为了获取传感器的回传数据要实现SensorEventListener接口;
..extands Activity implements SensorEventListener{...}
2,SensorEventListener接口有两个方法:
// 当传感器精度发生变化时调用方法
onAccuracyChanged();
// 当传感器数据发生变化时调用方法
onSensorChanged();
当Activity启动时,要注册传感器
protected void onResume() {
super.onResume();
// 注册加速度传感器,频率【一般】