本文整理汇总了Java中android.hardware.SensorManager.SENSOR_STATUS_UNRELIABLE属性的典型用法代码示例。如果您正苦于以下问题:Java SensorManager.SENSOR_STATUS_UNRELIABLE属性的具体用法?Java SensorManager.SENSOR_STATUS_UNRELIABLE怎么用?Java SensorManager.SENSOR_STATUS_UNRELIABLE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.hardware.SensorManager
的用法示例。
在下文中一共展示了SensorManager.SENSOR_STATUS_UNRELIABLE属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onAccuracyChanged
@Override
public final void onAccuracyChanged(Sensor sensor, int accuracy) {
threadChecker.checkIsOnValidThread();
AppRTCUtils.assertIsTrue(sensor.getType() == Sensor.TYPE_PROXIMITY);
if (accuracy == SensorManager.SENSOR_STATUS_UNRELIABLE) {
Log.e(TAG, "The values returned by this sensor cannot be trusted");
}
}
示例2: onSensorChanged
@Override
public void onSensorChanged(SensorEvent event) {
if (internalCompassListener == null) {
return;
}
// check when the last time the compass was updated, return if too soon.
long currentTime = SystemClock.elapsedRealtime();
if (currentTime < compassUpdateNextTimestamp) {
return;
}
if (lastAccuracy == SensorManager.SENSOR_STATUS_UNRELIABLE) {
Timber.d("Compass sensor is unreliable, device calibration is needed.");
return;
}
if (event.sensor.getType() == Sensor.TYPE_ROTATION_VECTOR) {
updateOrientation(event.values);
// Update the compassUpdateNextTimestamp
compassUpdateNextTimestamp = currentTime + LocationLayerConstants.COMPASS_UPDATE_RATE_MS;
} else if (event.sensor.getType() == Sensor.TYPE_ORIENTATION) {
internalCompassListener.onCompassChanged((event.values[0] + 360) % 360);
for (CompassListener compassListener : compassListeners) {
compassListener.onCompassChanged((event.values[0] + 360) % 360);
}
}
}
示例3: start
@ProtoMethod(description = "Start the light sensor. Returns the intensity. The value per device might vary", example = "")
@ProtoMethodParam(params = {"function(intensity)"})
public void start() {
super.start();
mListener = new SensorEventListener() {
@Override
public void onSensorChanged(SensorEvent event) {
ReturnObject r = new ReturnObject();
r.put("intensity", event.values[0]);
mCallbackLightChange.event(r);
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
switch (accuracy) {
case SensorManager.SENSOR_STATUS_UNRELIABLE:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_LOW:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_MEDIUM:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_HIGH:
break;
}
}
};
isEnabled = mSensormanager.registerListener(mListener, sensor, speed);
}
示例4: onAccuracyChanged
@Override
public final void onAccuracyChanged(Sensor sensor, int accuracy) {
threadChecker.checkIsOnValidThread();
Utils.assertIsTrue(sensor.getType() == Sensor.TYPE_PROXIMITY);
if (accuracy == SensorManager.SENSOR_STATUS_UNRELIABLE) {
Log.e(TAG, "The values returned by this sensor cannot be trusted");
}
}
示例5: onAccuracyChanged
@Override
public final void onAccuracyChanged(Sensor sensor, int accuracy) {
threadChecker.checkIsOnValidThread();
AppRTCUtils.assertIsTrue(sensor.getType() == Sensor.TYPE_PROXIMITY);
if (accuracy == SensorManager.SENSOR_STATUS_UNRELIABLE) {
Log.e(TAG, "The values returned by this sensor cannot be trusted");
}
}
示例6: onSensorChanged
@Override
public void onSensorChanged(SensorEvent event) {
// If sensor is unreliable, then just return
if (event.accuracy == SensorManager.SENSOR_STATUS_UNRELIABLE) {
return;
}
if(event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
detectShake(event);
}
}
示例7: start
public void start() {
super.start();
mListener = new SensorEventListener() {
@Override
public void onSensorChanged(SensorEvent event) {
ReturnObject r = new ReturnObject();
r.put("x", event.values[0]);
r.put("y", event.values[1]);
r.put("z", event.values[2]);
mCallback.event(r);
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
switch (accuracy) {
case SensorManager.SENSOR_STATUS_UNRELIABLE:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_LOW:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_MEDIUM:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_HIGH:
break;
}
}
};
isEnabled = mSensormanager.registerListener(mListener, sensor, speed);
}
示例8: start
@ProtoMethod(description = "Start the proximity sensor. Returns a proximity value. It might differ per device", example = "")
@ProtoMethodParam(params = {"function(proximity)"})
public void start() {
super.start();
mListener = new SensorEventListener() {
@Override
public void onSensorChanged(SensorEvent event) {
ReturnObject r = new ReturnObject();
r.put("distance", event.values[0]);
mCallback.event(r);
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
switch (accuracy) {
case SensorManager.SENSOR_STATUS_UNRELIABLE:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_LOW:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_MEDIUM:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_HIGH:
break;
}
}
};
isEnabled = mSensormanager.registerListener(mListener, sensor, speed);
}
示例9: start
public void start() {
super.start();
mListener = new SensorEventListener() {
@Override
public void onSensorChanged(SensorEvent event) {
ReturnObject r = new ReturnObject();
r.put("bar", event.values[0]);
mCallback.event(r);
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
switch (accuracy) {
case SensorManager.SENSOR_STATUS_UNRELIABLE:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_LOW:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_MEDIUM:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_HIGH:
break;
}
}
};
isEnabled = mSensormanager.registerListener(mListener, sensor, speed);
}
示例10: start
@ProtoMethod(description = "Start the orientation sensor. Returns pitch, roll, yaw", example = "")
@ProtoMethodParam(params = {"function(pitch, roll, yaw)"})
public void start() {
super.start();
mListener = new SensorEventListener() {
@Override
public void onSensorChanged(SensorEvent event) {
ReturnObject r = new ReturnObject();
r.put("azimuth", event.values[0]);
r.put("pitch", event.values[1]);
r.put("roll", event.values[2]);
mCallbackOrientationChange.event(r);
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
switch (accuracy) {
case SensorManager.SENSOR_STATUS_UNRELIABLE:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_LOW:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_MEDIUM:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_HIGH:
break;
}
}
};
isEnabled = mSensormanager.registerListener(mListener, sensor, speed);
}
示例11: start
public void start() {
super.start();
mListener = new SensorEventListener() {
@Override
public void onSensorChanged(SensorEvent event) {
if (mCallback != null) {
ReturnObject r = new ReturnObject();
r.put("x", event.values[0]);
r.put("y", event.values[1]);
r.put("z", event.values[2]);
float force = (float) Math.sqrt(Math.pow(event.values[0], 2) + Math.pow(event.values[1], 2) + Math.pow(event.values[2], 2));
r.put("force", force);
mCallback.event(r);
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
switch (accuracy) {
case SensorManager.SENSOR_STATUS_UNRELIABLE:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_LOW:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_MEDIUM:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_HIGH:
break;
}
}
};
isEnabled = mSensormanager.registerListener(mListener, sensor, speed);
}
示例12: start
@ProtoMethod(description = "Start the magnetic sensor", example = "")
@ProtoMethodParam(params = {"function(value)"})
public void start() {
super.start();
mListener = new SensorEventListener() {
@Override
public void onSensorChanged(SensorEvent event) {
ReturnObject r = new ReturnObject();
r.put("x", event.values[0]);
r.put("y", event.values[1]);
r.put("z", event.values[2]);
mCallbackMagneticChange.event(r);
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
switch (accuracy) {
case SensorManager.SENSOR_STATUS_UNRELIABLE:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_LOW:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_MEDIUM:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_HIGH:
break;
}
}
};
isEnabled = mSensormanager.registerListener(mListener, sensor, speed);
}
示例13: start
@ProtoMethod(description = "Start the step counter. Not superacurate and only few devices", example = "")
@ProtoMethodParam(params = {"function(value)"})
public void start() {
super.start();
mListener = new SensorEventListener() {
@Override
public void onSensorChanged(SensorEvent event) {
mCallback.event(null);
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
switch (accuracy) {
case SensorManager.SENSOR_STATUS_UNRELIABLE:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_LOW:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_MEDIUM:
break;
case SensorManager.SENSOR_STATUS_ACCURACY_HIGH:
break;
}
}
};
isEnabled = mSensormanager.registerListener(mListener, sensor, speed);
}