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:com.phonegap.CompassListener.java
/** * Start listening for compass sensor.//from www.j a v a 2s . c om * * @return status of listener */ public int start() { // If already starting or running, then just return if ((this.status == CompassListener.RUNNING) || (this.status == CompassListener.STARTING)) { return this.status; } // Get accelerometer from sensor manager List<Sensor> list = this.sensorManager.getSensorList(Sensor.TYPE_ORIENTATION); // If found, then register as listener if (list.size() > 0) { this.mSensor = list.get(0); this.sensorManager.registerListener(this, this.mSensor, SensorManager.SENSOR_DELAY_NORMAL); this.lastAccessTime = System.currentTimeMillis(); this.setStatus(CompassListener.STARTING); } // If error, then set status to error else { this.setStatus(CompassListener.ERROR_FAILED_TO_START); } return this.status; }
From source file:com.hyung.jin.seo.getup.wear.G3tUpActivity.java
@Override protected void onResume() { super.onResume(); // update threshold setUpThreshold();//from ww w . j a va2s .com if (sensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_NORMAL)) { if (Log.isLoggable(G3tUpConstants.TAG, Log.DEBUG)) { Log.d(G3tUpConstants.TAG, "Successfully registered for the sensor updates"); } } }
From source file:me.ziccard.secureit.fragment.AccelerometerFragment.java
@Override public void onResume() { super.onResume(); view = new AccelerometerGLSurfaceView(this.getActivity()); ((FrameLayout) getActivity().findViewById(R.id.opengl)).addView(view); accelerometerText = (TextView) getActivity().findViewById(R.id.accelerometer_text); sensorMgr = (SensorManager) getActivity().getSystemService(Activity.SENSOR_SERVICE); accelerometer = (Sensor) sensorMgr.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); if (accelerometer == null) { Log.i("AccelerometerFrament", "Warning: no accelerometer"); } else {/*from w w w . j a v a2 s .c o m*/ sensorMgr.registerListener(this, accelerometer, SensorManager.SENSOR_DELAY_NORMAL); } }
From source file:org.apache.cordova.CompassListener.java
/** * Start listening for compass sensor.// www .j a v a 2 s. c om * * @return status of listener */ public int start() { // If already starting or running, then just return if ((this.status == CompassListener.RUNNING) || (this.status == CompassListener.STARTING)) { return this.status; } // Get compass sensor from sensor manager @SuppressWarnings("deprecation") List<Sensor> list = this.sensorManager.getSensorList(Sensor.TYPE_ORIENTATION); // If found, then register as listener if (list != null && list.size() > 0) { this.mSensor = list.get(0); this.sensorManager.registerListener(this, this.mSensor, SensorManager.SENSOR_DELAY_NORMAL); this.lastAccessTime = System.currentTimeMillis(); this.setStatus(CompassListener.STARTING); } // If error, then set status to error else { this.setStatus(CompassListener.ERROR_FAILED_TO_START); } return this.status; }
From source file:cn.edu.gdmec.t00385.lightsensor.LightSensorListener.java
/** * Start listening for compass sensor.// w w w . j ava2 s. com * * @return status of listener */ public int start() { // If already starting or running, then just return if ((this.status == LightSensorListener.RUNNING) || (this.status == LightSensorListener.STARTING)) { return this.status; } // Get compass sensor from sensor manager @SuppressWarnings("deprecation") List<Sensor> list = this.sensorManager.getSensorList(Sensor.TYPE_LIGHT); // If found, then register as listener if (list != null && list.size() > 0) { this.mSensor = list.get(0); this.sensorManager.registerListener(this, this.mSensor, SensorManager.SENSOR_DELAY_NORMAL); this.lastAccessTime = System.currentTimeMillis(); this.setStatus(LightSensorListener.STARTING); } // If error, then set status to error else { this.setStatus(LightSensorListener.ERROR_FAILED_TO_START); } return this.status; }
From source file:nl.atcomputing.spacetravelagency.activities.MainActivity.java
@Override protected void onResume() { super.onResume(); if (Preferences.animateBackground()) { this.backgroundImageView = (ImageView) findViewById(R.id.background_image); this.backgroundBitmapImage = BitmapFactory.decodeResource(getResources(), R.drawable.milky_way); this.sensorManager.registerListener(this, this.sensor, SensorManager.SENSOR_DELAY_NORMAL); }/*from w w w. j av a 2s . com*/ StateSingleton state = StateSingleton.getInstance(); Log.d("MainActivity", "onResume: state=" + state); if (this.layoutTag.contentEquals(TAG_LANDSCAPE)) { if (state.isCheckingOut() || state.isPlacingOrder()) { showCheckout(); } else if (state.isShowingPlanetInfo()) { showPlanetInfo(); } else { state.setSelectingDestinations(); } } this.broadcastReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { updateButton(); } }; registerReceiver(this.broadcastReceiver, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE")); updateButton(); }
From source file:de.sixtyfourktec.mirrorhub.Main.java
@Override public void onResume() { super.onResume(); moduleManager.start();//w ww . j a va 2s . c om if (sensorManager != null) { sensorManager.registerListener(this, proximitySensor, SensorManager.SENSOR_DELAY_NORMAL); dimHandler.postDelayed(dimRunnable, dimDelay); } }
From source file:ch.bfh.sensordataprocessor.sensor.SensorDisplayFragment.java
public void displaySensor(Sensor sensor) { if (BuildConfig.DEBUG) { Log.d(TAG, "display the sensor"); }//from w ww.j a va 2 s . com this.sensor = sensor; name.setText(sensor.getName()); type.setText(String.valueOf(sensor.getType())); maxRange.setText(String.valueOf(sensor.getMaximumRange())); minDelay.setText(String.valueOf(sensor.getMinDelay())); power.setText(String.valueOf(sensor.getPower())); resolution.setText(String.valueOf(sensor.getResolution())); vendor.setText(String.valueOf(sensor.getVendor())); version.setText(String.valueOf(sensor.getVersion())); sensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_NORMAL); }
From source file:org.awokenwell.proximity.ProximitySensorListener.java
/** * Start listening for compass sensor.//from ww w. ja va 2s . co m * * @return status of listener */ public int start() { // If already starting or running, then just return if ((this.status == ProximitySensorListener.RUNNING) || (this.status == ProximitySensorListener.STARTING)) { return this.status; } // Get proximity sensor from sensor manager //@SuppressWarnings("deprecation") //List<Sensor> list = this.sensorManager.getSensorList(Sensor.TYPE_PROXIMITY); this.mSensor = sensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY); sensorManager.registerListener(this, this.mSensor, SensorManager.SENSOR_DELAY_NORMAL); this.lastAccessTime = System.currentTimeMillis(); this.setStatus(ProximitySensorListener.STARTING); // // If found, then register as listener // if (list != null && list.size() > 0) { // this.mSensor = list.get(0); // this.sensorManager.registerListener(this, this.mSensor, SensorManager.SENSOR_DELAY_NORMAL); // this.lastAccessTime = System.currentTimeMillis(); // this.setStatus(ProximitySensorListener.STARTING); // } // // // If error, then set status to error // else { // this.setStatus(ProximitySensorListener.ERROR_FAILED_TO_START); // } return this.status; }
From source file:com.microsoft.band.sdksample.SensorsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_sensors, container, false); senSensorManager1 = (SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE); senSensorManager2 = (SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE); senGyroscope = senSensorManager1.getDefaultSensor(Sensor.TYPE_GYROSCOPE); senSensorManager1.registerListener(this, senGyroscope, SensorManager.SENSOR_DELAY_NORMAL); senAccelerometer = senSensorManager2.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); senSensorManager2.registerListener(this, senAccelerometer, SensorManager.SENSOR_DELAY_NORMAL); mTableAcc = (TableLayout) rootView.findViewById(R.id.tableAcc); mTableAcc.setVisibility(View.GONE); mTextAccX = (TextView) rootView.findViewById(R.id.textAccX); mTextAccY = (TextView) rootView.findViewById(R.id.textAccY); mTextAccZ = (TextView) rootView.findViewById(R.id.textAccZ); mTextAngX = (TextView) rootView.findViewById(R.id.textPAngX); mTextAngY = (TextView) rootView.findViewById(R.id.textPAngY); mTextAngZ = (TextView) rootView.findViewById(R.id.textPAngZ); mTextLong = (TextView) rootView.findViewById(R.id.textLong); mTextLat = (TextView) rootView.findViewById(R.id.textLat); mTextTime = (TextView) rootView.findViewById(R.id.textTime); temp_list = new double[14]; c = 0;//from ww w . ja v a 2s . c om // Acquire a reference to the system Location Manager LocationManager locationManager = (LocationManager) getActivity() .getSystemService(Context.LOCATION_SERVICE); // Define a listener that responds to location updates LocationListener locationListener = new LocationListener() { public void onLocationChanged(Location location) { // Called when a new location is found by the network location provider. temp_list[12] = location.getLongitude(); temp_list[13] = location.getLatitude(); mTextLong.setText(Double.toString(temp_list[12])); mTextLat.setText(Double.toString(temp_list[13])); } public void onStatusChanged(String provider, int status, Bundle extras) { } public void onProviderEnabled(String provider) { } public void onProviderDisabled(String provider) { } }; // Register the listener with the Location Manager to receive location updates locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener); runnable.run(); // // Gyro setup // mTableGyro = (TableLayout) rootView.findViewById(R.id.tableGyro); mTableGyro.setVisibility(View.GONE); mTextGyroAccX = (TextView) rootView.findViewById(R.id.textGyroAccX); mTextGyroAccY = (TextView) rootView.findViewById(R.id.textGyroAccY); mTextGyroAccZ = (TextView) rootView.findViewById(R.id.textGyroAccZ); mTextGyroAngX = (TextView) rootView.findViewById(R.id.textAngX); mTextGyroAngY = (TextView) rootView.findViewById(R.id.textAngY); mTextGyroAngZ = (TextView) rootView.findViewById(R.id.textAngZ); // // Contact setup // mTableContact = (TableLayout) rootView.findViewById(R.id.tableContact); mTableContact.setVisibility(View.GONE); mTextContact = (TextView) rootView.findViewById(R.id.textContact); turnOnSensors(); return rootView; }