java for step_Java Sensor.TYPE_STEP_COUNTER属性代码示例

@SuppressWarnings("deprecation")

private boolean isRestricted(XParam param, int type) throws Throwable {

if (type == Sensor.TYPE_ALL)

return false;

else if (type == Sensor.TYPE_ACCELEROMETER || type == Sensor.TYPE_LINEAR_ACCELERATION) {

if (isRestricted(param, "acceleration"))

return true;

} else if (type == Sensor.TYPE_GRAVITY) {

if (isRestricted(param, "gravity"))

return true;

} else if (type == Sensor.TYPE_RELATIVE_HUMIDITY) {

if (isRestricted(param, "humidity"))

return true;

} else if (type == Sensor.TYPE_LIGHT) {

if (isRestricted(param, "light"))

return true;

} else if (type == Sensor.TYPE_MAGNETIC_FIELD || type == Sensor.TYPE_MAGNETIC_FIELD_UNCALIBRATED) {

if (isRestricted(param, "magnetic"))

return true;

} else if (type == Sensor.TYPE_SIGNIFICANT_MOTION) {

if (isRestricted(param, "motion"))

return true;

} else if (type == Sensor.TYPE_ORIENTATION || type == Sensor.TYPE_GYROSCOPE

|| type == Sensor.TYPE_GYROSCOPE_UNCALIBRATED) {

if (isRestricted(param, "orientation"))

return true;

} else if (type == Sensor.TYPE_PRESSURE) {

if (isRestricted(param, "pressure"))

return true;

} else if (type == Sensor.TYPE_PROXIMITY) {

if (isRestricted(param, "proximity"))

return true;

} else if (type == Sensor.TYPE_GAME_ROTATION_VECTOR || type == Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR

|| type == Sensor.TYPE_ROTATION_VECTOR) {

if (isRestricted(param, "rotation"))

return true;

} else if (type == Sensor.TYPE_TEMPERATURE || type == Sensor.TYPE_AMBIENT_TEMPERATURE) {

if (isRestricted(param, "temperature"))

return true;

} else if (type == Sensor.TYPE_STEP_COUNTER || type == Sensor.TYPE_STEP_DETECTOR) {

if (isRestricted(param, "step"))

return true;

} else if (type == Sensor.TYPE_HEART_RATE) {

if (isRestricted(param, "heartrate"))

return true;

} else if (type == 22) {

// 22 = TYPE_TILT_DETECTOR

// Do nothing

} else if (type == 23 || type == 24 || type == 25) {

// 23 = TYPE_WAKE_GESTURE

// 24 = TYPE_GLANCE_GESTURE

// 25 = TYPE_PICK_UP_GESTURE

// 23/24 This sensor is expected to only be used by the system ui

// 25 Expected to be used internally for always on display

} else

Util.log(this, Log.WARN, "Unknown sensor type=" + type);

return false;

}


版权声明:本文为weixin_29514913原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。