If I run anywhere, the sensor change ?
I tried source code bellow:
Get SensorManeger:
mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
Get Sensor:
mMagnetic = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
Implement SensorEventListener:
public class MagneticActivity extends Activity implements SensorEventListener{
@Override public void onSensorChanged(SensorEvent event) { Log.d("test", "onSensorChanged:" + event.timestamp + ":" + "x=" + event.values[0] + "y=" + event.values[1] + "z=" + event.values[2]); }
source code here
0 件のコメント:
コメントを投稿