当前位置: 首页>>代码示例>>Java>>正文


Java SensorManager.SENSOR_STATUS_UNRELIABLE属性代码示例

本文整理汇总了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");
  }
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:8,代码来源:AppRTCProximitySensor.java

示例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);
    }
  }
}
 
开发者ID:mapbox,项目名称:mapbox-plugins-android,代码行数:26,代码来源:CompassManager.java

示例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);
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:32,代码来源:PLightIntensity.java

示例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");
    }
}
 
开发者ID:nhancv,项目名称:nc-android-webrtcpeer,代码行数:8,代码来源:ProximitySensor.java

示例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");
    }
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:8,代码来源:AppRTCProximitySensor.java

示例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);
    }
}
 
开发者ID:squareboat,项目名称:Excuser,代码行数:11,代码来源:AccelerometerSensorService.java

示例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);
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:32,代码来源:PGyroscope.java

示例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);
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:32,代码来源:PProximity.java

示例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);
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:30,代码来源:PPressure.java

示例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);
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:35,代码来源:POrientation.java

示例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);
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:37,代码来源:PAccelerometer.java

示例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);
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:34,代码来源:PMagnetic.java

示例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);
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:30,代码来源:PStep.java


注:本文中的android.hardware.SensorManager.SENSOR_STATUS_UNRELIABLE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。