List of usage examples for android.hardware SensorManager SENSOR_DELAY_NORMAL
int SENSOR_DELAY_NORMAL
To view the source code for android.hardware SensorManager SENSOR_DELAY_NORMAL.
Click Source Link
From source file:io.github.data4all.service.OrientationListener.java
@Override public void onCreate() { sManager = (SensorManager) getSystemService(SENSOR_SERVICE); accelerometer = sManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); magnetometer = sManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); sManager.registerListener(this, sManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_NORMAL); sManager.registerListener(this, sManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD), SensorManager.SENSOR_DELAY_NORMAL); }
From source file:org.mozilla.mozstumbler.service.stumblerthread.motiondetection.LegacyMotionSensor.java
@Override public void start() { mSensorManager.registerListener(mSensorEventListener, mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_NORMAL); isActive = true;//from w w w. j a v a 2 s .c om }
From source file:org.sociotech.fishification.ui.fragments.FeedFishFragment.java
@Override public void onResume() { super.onResume(); // Register for Sensor changes if (m_sensorManager != null) { m_sensorManager.registerListener(this, m_sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_NORMAL); }/*from w w w . j av a 2 s.com*/ }
From source file:de.tudarmstadt.dvs.myhealthassistant.myhealthhub.services.InternalSensorService.java
@Override public void onCreate() { // The service is being created Log.e(TAG, "onCreate"); mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); pref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); if (pref.getBoolean(getResources().getString(R.string.in_acc), false)) { Sensor mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); mSensorManager.registerListener(this, mSensor, SensorManager.SENSOR_DELAY_NORMAL); }// www. j a v a 2s .c om if (pref.getBoolean(getResources().getString(R.string.in_lig), false)) { Sensor mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_LIGHT); mSensorManager.registerListener(this, mSensor, SensorManager.SENSOR_DELAY_NORMAL); } if (pref.getBoolean(getResources().getString(R.string.in_pres), false)) { Sensor mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PRESSURE); mSensorManager.registerListener(this, mSensor, SensorManager.SENSOR_DELAY_NORMAL); } if (pref.getBoolean(getResources().getString(R.string.in_prox), false)) { Sensor mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY); mSensorManager.registerListener(this, mSensor, SensorManager.SENSOR_DELAY_NORMAL); } if (pref.getBoolean(getResources().getString(R.string.in_mag), false)) { Sensor mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); mSensorManager.registerListener(this, mSensor, SensorManager.SENSOR_DELAY_NORMAL); } if (pref.getBoolean(getResources().getString(R.string.in_gyrs), false)) { Sensor mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE); mSensorManager.registerListener(this, mSensor, SensorManager.SENSOR_DELAY_NORMAL); } if (pref.getBoolean(getResources().getString(R.string.in_grav), false)) { Sensor mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY); mSensorManager.registerListener(this, mSensor, SensorManager.SENSOR_DELAY_NORMAL); } if (pref.getBoolean(getResources().getString(R.string.in_hum), false)) { Sensor mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_RELATIVE_HUMIDITY); mSensorManager.registerListener(this, mSensor, SensorManager.SENSOR_DELAY_NORMAL); } if (pref.getBoolean(getResources().getString(R.string.in_lin_acc), false)) { Sensor mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_LINEAR_ACCELERATION); mSensorManager.registerListener(this, mSensor, SensorManager.SENSOR_DELAY_NORMAL); } if (pref.getBoolean(getResources().getString(R.string.in_tem), false)) { Sensor mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_AMBIENT_TEMPERATURE); mSensorManager.registerListener(this, mSensor, SensorManager.SENSOR_DELAY_NORMAL); } }
From source file:com.example.zoeoeh.ETuner.OpenGLClass.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment // Replaces setContentView - set the content to the XML activity containing the custom surface view View myView = inflater.inflate(R.layout.activity_open_glclass, container, false); // myGLview is my custom GL surface which sets the client version and initialises the renderer myGLview = (MyGLSurface) myView.findViewById(R.id.surfaceView); // switch handler for change events. controls looping of sound playing loopSwitch = (Switch) myView.findViewById(R.id.loopSwitch); loopSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override//from www.ja va 2s . co m public void onCheckedChanged(CompoundButton btn, boolean isChecked) { // bool used for setting looping state of media player loopingChecked = isChecked; updatePlay(); } }); playSwitch = (Switch) myView.findViewById(R.id.playSwitch); playSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton btn, boolean isChecked) { playChecked = isChecked; if (isChecked) { playSound(TabSwitcher.getmContext(), currentSoundIndex); } else { // if unchecked and player isn't null stop it. if (myPlayer != null) { stopPlay(); // stop vibrating of string TestRenderer.setChosenString(-1); } } } }); // initialise sensor listener mySensorMan = (SensorManager) TabSwitcher.getmContext().getSystemService(Context.SENSOR_SERVICE); myAccel = mySensorMan.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); mySensorMan.registerListener(this, myAccel, SensorManager.SENSOR_DELAY_NORMAL); // return this view return myView; }
From source file:com.polyvi.xface.extension.XCompassExt.java
/** * ?compass sensor// w ww.j av a 2 s .c om */ private int start() { if ((mStatus == RUNNING) || (mStatus == STARTING)) { return mStatus; } //FIXME:SENSOR_SERVICE?hang? // ? if (null == mSensorManager) { mSensorManager = (SensorManager) getContext().getSystemService(Context.SENSOR_SERVICE); } List<Sensor> list = mSensorManager.getSensorList(Sensor.TYPE_ORIENTATION); if (list != null && list.size() > 0) { mSensor = list.get(0); mSensorManager.registerListener(this, mSensor, SensorManager.SENSOR_DELAY_NORMAL); mLastAccessTime = System.currentTimeMillis(); mStatus = STARTING; } else { mStatus = ERROR_FAILED_TO_START; } return mStatus; }
From source file:csic.ceab.movelab.beepath.MainActivity.java
@Override protected void onResume() { PropertyHolder.useSensorACCELEROMETER(true); PropertyHolder.useSensorGRAVITY(false); PropertyHolder.useSensorMAGNETIC_FIELD(false); PropertyHolder.useSensorGYROSCOPE(false); PropertyHolder.useSensorLINEAR_ACCELERATION(false); PropertyHolder.useSensorORIENTATION(false); PropertyHolder.sensorDelayACCELEROMETER(SensorManager.SENSOR_DELAY_NORMAL); PropertyHolder.sensorDelayGRAVITY(SensorManager.SENSOR_DELAY_NORMAL); PropertyHolder.sensorDelayGYROSCOPE(SensorManager.SENSOR_DELAY_NORMAL); PropertyHolder.sensorDelayLINEAR_ACCELERATION(SensorManager.SENSOR_DELAY_NORMAL); PropertyHolder.sensorDelayMAGNETIC_FIELD(SensorManager.SENSOR_DELAY_NORMAL); PropertyHolder.sensorDelayORIENTATION(SensorManager.SENSOR_DELAY_NORMAL); IntentFilter fixFilter;/* www . j a v a2 s . c o m*/ fixFilter = new IntentFilter( getResources().getString(R.string.internal_message_id) + Util.MESSAGE_FIX_RECORDED); fixReceiver = new FixReceiver(); registerReceiver(fixReceiver, fixFilter); super.onResume(); }
From source file:pl.mrwojtek.sensrec.app.SamplingPeriodDialog.java
@Override public void onClick(DialogInterface dialog, int which) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); int position = samplingSpinner.getSelectedItemPosition(); if (position == POSITION_CUSTOM) { try {//ww w. j av a 2 s.c om long delay = Long.valueOf(millisecondsEdit.getText().toString()); prefs.edit().putLong(SensorsRecorder.PREF_SAMPLING_PERIOD, delay).apply(); } catch (NumberFormatException ex) { Log.i(TAG, "Unable to save sampling delay: " + ex.getMessage()); } } else if (position == POSITION_NORMAL) { prefs.edit().putLong(SensorsRecorder.PREF_SAMPLING_PERIOD, SensorManager.SENSOR_DELAY_NORMAL).apply(); } else if (position == POSITION_UI) { prefs.edit().putLong(SensorsRecorder.PREF_SAMPLING_PERIOD, SensorManager.SENSOR_DELAY_UI).apply(); } else if (position == POSITION_GAME) { prefs.edit().putLong(SensorsRecorder.PREF_SAMPLING_PERIOD, SensorManager.SENSOR_DELAY_GAME).apply(); } else if (position == POSITION_FASTEST) { prefs.edit().putLong(SensorsRecorder.PREF_SAMPLING_PERIOD, SensorManager.SENSOR_DELAY_FASTEST).apply(); } }
From source file:net.texh.cordovapluginstepcounter.StepCounterService.java
public void doInit() { Log.i(TAG, "Registering STEP_DETECTOR sensor"); haveSetOffset = false;//from ww w. ja v a 2 s .co m mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); mStepSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_STEP_COUNTER); mSensorManager.registerListener(this, mStepSensor, SensorManager.SENSOR_DELAY_NORMAL); }
From source file:com.example.zoeoeh.ETuner.OpenGLClass.java
@Override public void onResume() { super.onResume(); myGLview.onResume(); // calls the surface view's onResume when the activity onResume mySensorMan.registerListener(this, myAccel, SensorManager.SENSOR_DELAY_NORMAL); }