List of usage examples for android.hardware SensorManager SENSOR_STATUS_ACCURACY_LOW
int SENSOR_STATUS_ACCURACY_LOW
To view the source code for android.hardware SensorManager SENSOR_STATUS_ACCURACY_LOW.
Click Source Link
From source file:ch.bfh.sensordataprocessor.sensor.SensorDisplayFragment.java
/** * @see android.hardware.SensorEventListener#onAccuracyChanged(android.hardware.Sensor, int) */// www. j a v a2s.c o m @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { switch (accuracy) { case SensorManager.SENSOR_STATUS_ACCURACY_HIGH: this.accuracy.setText("SENSOR_STATUS_ACCURACY_HIGH"); break; case SensorManager.SENSOR_STATUS_ACCURACY_MEDIUM: this.accuracy.setText("SENSOR_STATUS_ACCURACY_MEDIUM"); break; case SensorManager.SENSOR_STATUS_ACCURACY_LOW: this.accuracy.setText("SENSOR_STATUS_ACCURACY_LOW"); break; case SensorManager.SENSOR_STATUS_UNRELIABLE: this.accuracy.setText("SENSOR_STATUS_UNRELIABLE"); break; } }
From source file:net.line2soft.preambul.controllers.SlippyMapListener.java
@Override public void onAccuracyChanged(Sensor sensor, int accuracy) { if (sensor.getType() == Sensor.TYPE_ORIENTATION) { CompassView cp = (CompassView) activity.findViewById(R.id.compass); CompassView cpBig = (CompassView) activity.findViewById(R.id.compassBig); if (accuracy == SensorManager.SENSOR_STATUS_UNRELIABLE || accuracy == SensorManager.SENSOR_STATUS_ACCURACY_LOW) { activity.setAccurate(false); activity.displayInfo(activity.getString(R.string.message_compass_not_accurate)); cp.setVisibility(View.GONE); cpBig.setVisibility(View.GONE); } else {//from www . j a v a 2 s . c om activity.setAccurate(true); if (cp.getVisibility() == View.GONE && cpBig.getVisibility() == View.GONE) { cp.setVisibility(View.VISIBLE); } } } }
From source file:com.cellbots.logger.LoggerActivity.java
private void updateSensorUi(int sensorType, int accuracy, float[] values) { // IMPORTANT: DO NOT UPDATE THE CONTENTS INSIDE A DRAWER IF IT IS BEING // ANIMATED VIA A CALL TO animateOpen/animateClose!!! // Updating anything inside will stop the animation from running. // Note that this does not seem to affect the animation if it had been // triggered by dragging the drawer instead of being called // programatically. if (mDataDrawer.isMoving()) { return;//from ww w . j a v a 2 s. c o m } TextView xTextView; TextView yTextView; TextView zTextView; if (sensorType == Sensor.TYPE_ACCELEROMETER) { xTextView = mAccelXTextView; yTextView = mAccelYTextView; zTextView = mAccelZTextView; } else if (sensorType == Sensor.TYPE_GYROSCOPE) { xTextView = mGyroXTextView; yTextView = mGyroYTextView; zTextView = mGyroZTextView; } else if (sensorType == Sensor.TYPE_MAGNETIC_FIELD) { xTextView = mMagXTextView; yTextView = mMagYTextView; zTextView = mMagZTextView; } else { return; } int textColor = Color.WHITE; String prefix = ""; switch (accuracy) { case SensorManager.SENSOR_STATUS_ACCURACY_HIGH: prefix = " "; break; case SensorManager.SENSOR_STATUS_ACCURACY_MEDIUM: prefix = " *"; break; case SensorManager.SENSOR_STATUS_ACCURACY_LOW: prefix = " **"; break; case SensorManager.SENSOR_STATUS_UNRELIABLE: prefix = " ***"; break; } xTextView.setTextColor(textColor); yTextView.setTextColor(textColor); zTextView.setTextColor(textColor); xTextView.setText(prefix + numberDisplayFormatter(values[0])); yTextView.setText(prefix + numberDisplayFormatter(values[1])); zTextView.setText(prefix + numberDisplayFormatter(values[2])); }
From source file:com.example.sensingapp.SensingApp.java
public void onAccuracyChanged(Sensor sensor, int accuracy) { switch (sensor.getType()) { case Sensor.TYPE_ACCELEROMETER: m_sSensorAccuracy = "1,"; //Accl break;/*from w w w . java 2 s. c o m*/ case Sensor.TYPE_LINEAR_ACCELERATION: m_sSensorAccuracy = "2,"; //LinearAccl break; case Sensor.TYPE_GYROSCOPE: m_sSensorAccuracy = "3,"; //Gyro break; case Sensor.TYPE_MAGNETIC_FIELD: m_sSensorAccuracy = "4,"; //Magnet break; case Sensor.TYPE_GRAVITY: m_sSensorAccuracy = "5,"; //Gravity break; case Sensor.TYPE_PROXIMITY: m_sSensorAccuracy = "6,"; //Proxi break; case Sensor.TYPE_LIGHT: m_sSensorAccuracy = "7,"; //Light break; case Sensor.TYPE_PRESSURE: m_sSensorAccuracy = "8,"; //Barometer break; case Sensor.TYPE_RELATIVE_HUMIDITY: m_sSensorAccuracy = "9,"; //Humidity break; case Sensor.TYPE_AMBIENT_TEMPERATURE: m_sSensorAccuracy = "10,"; //Temperature break; default: m_sSensorAccuracy = "11,"; //Other } switch (accuracy) { case SensorManager.SENSOR_STATUS_ACCURACY_HIGH: m_sSensorAccuracy = m_sSensorAccuracy + "1,"; //H break; case SensorManager.SENSOR_STATUS_ACCURACY_MEDIUM: m_sSensorAccuracy = m_sSensorAccuracy + "2,"; //M break; case SensorManager.SENSOR_STATUS_ACCURACY_LOW: m_sSensorAccuracy = m_sSensorAccuracy + "3,"; //L break; case SensorManager.SENSOR_STATUS_UNRELIABLE: m_sSensorAccuracy = m_sSensorAccuracy + "4,"; //U break; } }