本文整理汇总了Java中android.hardware.SensorManager.SENSOR_DELAY_FASTEST属性的典型用法代码示例。如果您正苦于以下问题:Java SensorManager.SENSOR_DELAY_FASTEST属性的具体用法?Java SensorManager.SENSOR_DELAY_FASTEST怎么用?Java SensorManager.SENSOR_DELAY_FASTEST使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.hardware.SensorManager
的用法示例。
在下文中一共展示了SensorManager.SENSOR_DELAY_FASTEST属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: before
@Override
protected void before(XParam param) throws Throwable {
switch (mMethod) {
case getDefaultSensor:
if (isRestricted(param))
param.setResult(null);
else if (param.args.length > 0 && param.args[0] instanceof Integer)
if (isRestricted(param, (Integer) param.args[0]))
param.setResult(null);
break;
case getSensorList:
if (isRestricted(param))
param.setResult(new ArrayList<Sensor>());
else if (param.args.length > 0 && param.args[0] instanceof Integer)
if (isRestricted(param, (Integer) param.args[0]))
param.setResult(new ArrayList<Sensor>());
break;
case registerListener:
if (param.args.length > 2 && param.args[1] instanceof Sensor && param.args[2] instanceof Integer) {
int type = ((Sensor) param.args[1]).getType();
if (type == Sensor.TYPE_GYROSCOPE || type == Sensor.TYPE_GYROSCOPE_UNCALIBRATED) {
int rateUs = (Integer) param.args[2];
// http://developer.android.com/guide/topics/sensors/sensors_overview.html
if (rateUs == SensorManager.SENSOR_DELAY_NORMAL)
return; // 200,000 us
else if (rateUs == SensorManager.SENSOR_DELAY_UI)
return; // 60,000 us
else if (rateUs == SensorManager.SENSOR_DELAY_GAME)
return; // 20,000 us
else if (rateUs == SensorManager.SENSOR_DELAY_FASTEST)
; // 0 us
if (rateUs < cMaxRateUs) // 10,000 us
if (isRestricted(param))
param.args[2] = cMaxRateUs;
}
}
break;
}
}
示例2: configurarSensor
private void configurarSensor() {
this.mSensorManager = (SensorManager) mContext.getSystemService(mContext.SENSOR_SERVICE);
this.mAccelerometer = mSensorManager.getDefaultSensor(android.hardware.Sensor.TYPE_ACCELEROMETER);
this.mGyroscope = mSensorManager.getDefaultSensor(android.hardware.Sensor.TYPE_GYROSCOPE);
this.miSensorEventListenerAcelerometro = new MiSensorEventListener(this.mAccelerometer, this.mSensorManager, SensorManager.SENSOR_DELAY_FASTEST);
this.miSensorEventListenerGiroscopio = new MiSensorEventListener(this.mGyroscope, this.mSensorManager, SensorManager.SENSOR_DELAY_FASTEST);
}
示例3: sensorsSpeed
@ProtoMethod(description = "Set the speed of the sensor 'slow', 'fast', 'normal'", example = "")
@ProtoMethodParam(params = {"speed=['slow', 'fast', 'normal']"})
public void sensorsSpeed(String speed) {
if (speed.equals("slow")) {
this.speed = SensorManager.SENSOR_DELAY_UI;
} else if (speed.equals("fast")) {
this.speed = SensorManager.SENSOR_DELAY_FASTEST;
} else {
this.speed = SensorManager.SENSOR_DELAY_NORMAL;
}
}