use of android.hardware.SensorManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DoubleTwistPreferenceController method isGestureAvailable.
public static boolean isGestureAvailable(Context context) {
final Resources resources = context.getResources();
final String name = resources.getString(R.string.gesture_double_twist_sensor_name);
final String vendor = resources.getString(R.string.gesture_double_twist_sensor_vendor);
if (!TextUtils.isEmpty(name) && !TextUtils.isEmpty(vendor)) {
final SensorManager sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
for (Sensor s : sensorManager.getSensorList(Sensor.TYPE_ALL)) {
if (name.equals(s.getName()) && vendor.equals(s.getVendor())) {
return true;
}
}
}
return false;
}
use of android.hardware.SensorManager in project gdk-compass-sample by googleglass.
the class CompassService method onCreate.
@Override
public void onCreate() {
super.onCreate();
// Even though the text-to-speech engine is only used in response to a menu action, we
// initialize it when the application starts so that we avoid delays that could occur
// if we waited until it was needed to start it up.
mSpeech = new TextToSpeech(this, new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
// Do nothing.
}
});
SensorManager sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
mOrientationManager = new OrientationManager(sensorManager, locationManager);
mLandmarks = new Landmarks(this);
}
use of android.hardware.SensorManager in project sensey by nisrulz.
the class SenseyTest method setUp.
@Before
public void setUp() {
Context context = ApplicationProvider.getApplicationContext();
shadowSensorManager = Shadows.shadowOf((SensorManager) context.getSystemService(SENSOR_SERVICE));
sensey = Sensey.getInstance();
sensey.init(context);
}
use of android.hardware.SensorManager in project edx-app-android by edx.
the class OrientationDetector method stop.
public void stop() {
SensorManager mSensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
mSensorManager.unregisterListener(this);
logger.warn("stopped orientation sensor");
}
use of android.hardware.SensorManager in project edx-app-android by edx.
the class OrientationDetector method start.
public void start() {
SensorManager mSensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
Sensor mSensorOrientation = mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);
if (mSensorOrientation != null) {
mSensorManager.registerListener(this, mSensorOrientation, SensorManager.SENSOR_DELAY_NORMAL);
logger.debug("started sensor: " + mSensorOrientation.toString());
} else {
logger.warn("sensor NOT available");
}
}
Aggregations