¡@

Home 

2014/10/16 ¤W¤È 08:23:40

android Programming Glossary: sensormanager

Convert magnetic field X, Y, Z values from device into global reference frame

http://stackoverflow.com/questions/15315129/convert-magnetic-field-x-y-z-values-from-device-into-global-reference-frame

import android.hardware.SensorManager import android.opengl.Matrix import android.os.Bundle import.. final double MEASUREMENT_NOISE 5 Sensor manager. private SensorManager mSensorManager Magnetometer spec. private TextView vendor private.. MEASUREMENT_NOISE 5 Sensor manager. private SensorManager mSensorManager Magnetometer spec. private TextView vendor private TextView..

Android Compass that can Compensate for Tilt and Pitch

http://stackoverflow.com/questions/16317599/android-compass-that-can-compensate-for-tilt-and-pitch

sensor data without any API calls to e.g. SensorManager.getRotationMatrix ... or SensorManager.getOrientation ... ... API calls to e.g. SensorManager.getRotationMatrix ... or SensorManager.getOrientation ... . The code could probably be improved e.g... int SENSOR_UNAVAILABLE 1 references to other objects SensorManager m_sm SensorEventListener m_parent non null if this class should..

Rotate MapView in Android

http://stackoverflow.com/questions/1830391/rotate-mapview-in-android

null private boolean mModeCompass false private SensorManager mSensorManager private LinearLayout mRotateViewContainer private.. private boolean mModeCompass false private SensorManager mSensorManager private LinearLayout mRotateViewContainer private RotateView.. savedInstanceState setContentView R.layout.maplayout mSensorManager SensorManager getSystemService SENSOR_SERVICE mRotateViewContainer..

Android: I want to shake it

http://stackoverflow.com/questions/2317428/android-i-want-to-shake-it

activity class put this into your activity class private SensorManager mSensorManager private float mAccel acceleration apart from.. put this into your activity class private SensorManager mSensorManager private float mAccel acceleration apart from gravity private.. @Override protected void onResume super.onResume mSensorManager.registerListener mSensorListener mSensorManager.getDefaultSensor..

android: turn off screen when close to face

http://stackoverflow.com/questions/3018716/android-turn-off-screen-when-close-to-face

How to detect shake event with android?

http://stackoverflow.com/questions/5271448/how-to-detect-shake-event-with-android

implements SensorListener You will need to acquire a SensorManager sensorMgr SensorManager getSystemService SENSOR_SERVICE And.. You will need to acquire a SensorManager sensorMgr SensorManager getSystemService SENSOR_SERVICE And register this sensor with.. sensor with desired flags ensorMgr.registerListener this SensorManager.SENSOR_ACCELEROMETER SensorManager.SENSOR_DELAY_GAME In your..

android compass seems unreliable

http://stackoverflow.com/questions/6256256/android-compass-seems-unreliable

If the sensor data is unreliable return if event.accuracy SensorManager.SENSOR_STATUS_UNRELIABLE Toast.makeText main.this Sensor Status.. break if m_vfgravity null m_vfgeomag null if SensorManager.getRotationMatrix m_vfinR m_vfI m_vfgravity m_vfgeomag SensorManager.getOrientation.. m_vfinR m_vfI m_vfgravity m_vfgeomag SensorManager.getOrientation m_vfinR m_vforientVals m_fCompBearing float..

Moving an image using Accelerometer of android

http://stackoverflow.com/questions/6457768/moving-an-image-using-accelerometer-of-android

import android.hardware.SensorManager import android.os.Bundle import android.view.View import android.widget.TextView.. mDrawable new ShapeDrawable int x int y private SensorManager sensorManager null Called when the activity is first created... super.onCreate savedInstanceState Get a reference to a SensorManager sensorManager SensorManager getSystemService SENSOR_SERVICE..

Android accelerometer not working when screen is turned off

http://stackoverflow.com/questions/9982433/android-accelerometer-not-working-when-screen-is-turned-off

protected void onHandleIntent Intent intent sensorManager SensorManager getSystemService SENSOR_SERVICE sensorManager.unregisterListener.. sensorManager.getDefaultSensor Sensor.TYPE_ACCELEROMETER SensorManager.SENSOR_DELAY_NORMAL synchronized this boolean run true while.. getLock AccelerometerService.this .acquire sensorManager SensorManager getSystemService SENSOR_SERVICE sensorManager.unregisterListener..

Vintage Thermometer custom UI component + SensorSimulator (steps to test the component on the emulator)

http://stackoverflow.com/questions/10099084/vintage-thermometer-custom-ui-component-sensorsimulator-steps-to-test-the-com

was private void attachToSensor SensorManagerSimulator sensorManager getSensorManager sensorManager.connectSimulator Since it seems.. SensorManagerSimulator sensorManager getSensorManager sensorManager.connectSimulator Since it seems sensorsimulator doesn't implement.. getSensorList I had to replace List Sensor sensors sensorManager.getSensorList Sensor.TYPE_TEMPERATURE with Sensor sensor sensorManager.getDefaultSensor..

Android getOrientation() method returns bad results

http://stackoverflow.com/questions/10192057/android-getorientation-method-returns-bad-results

0 private Compass3DView mCompassView private SensorManager sensorManager sensor calculation values float mGravity null float mGeomagnetic.. ll.addView mTextView_filtered_roll setContentView ll sensorManager SensorManager this.getSystemService Context.SENSOR_SERVICE sensorManager.registerListener.. SensorManager this.getSystemService Context.SENSOR_SERVICE sensorManager.registerListener mAccelerometerListener sensorManager.getDefaultSensor..

Gyroscope Issues with Device Orientation

http://stackoverflow.com/questions/14310347/gyroscope-issues-with-device-orientation

gyroMatrix 6 0.0f gyroMatrix 7 0.0f gyroMatrix 8 1.0f get sensorManager and initialise sensor listeners mSensorManager SensorManager..

How to open/display documents(.pdf, .doc) without external app?

http://stackoverflow.com/questions/14578530/how-to-open-display-documents-pdf-doc-without-external-app

document with external app my button disappears and the sensorManager works neither. Have someone any idea to solve this problem...

Rotating phone quickly 180 degrees, camera preview turns upside down

http://stackoverflow.com/questions/19532599/rotating-phone-quickly-180-degrees-camera-preview-turns-upside-down

public final String TAG CustomCamera private SensorManager sensorManager @Override public void onCreate Bundle savedInstanceState super.onCreate.. setContentView R.layout.main context this sensorManager SensorManager getSystemService SENSOR_SERVICE mOrientaion1 sensorManager.getDefaultSensor.. SensorManager getSystemService SENSOR_SERVICE mOrientaion1 sensorManager.getDefaultSensor Sensor.TYPE_ORIENTATION setRequestedOrientation..

Moving an image using Accelerometer of android

http://stackoverflow.com/questions/6457768/moving-an-image-using-accelerometer-of-android

new ShapeDrawable int x int y private SensorManager sensorManager null Called when the activity is first created. @Override public.. savedInstanceState Get a reference to a SensorManager sensorManager SensorManager getSystemService SENSOR_SERVICE mCustomDrawableView.. this class as a listener for the accelerometer sensor sensorManager.registerListener this sensorManager.getDefaultSensor Sensor.TYPE_ACCELEROMETER..

SensorEventListener doesn't get unregistered with unregisterListener() method

http://stackoverflow.com/questions/6919577/sensoreventlistener-doesnt-get-unregistered-with-unregisterlistener-method

SensorThread Running . The registration code sensorManager SensorManager getSystemService Context.SENSOR_SERVICE List Sensor.. Context.SENSOR_SERVICE List Sensor sensors sensorManager.getSensorList Sensor.TYPE_ORIENTATION if sensors.size 0 sensor.. if sensors.size 0 sensor sensors.get 0 running sensorManager.registerListener sensorEventListener sensor SensorManager.SENSOR_DELAY_FASTEST..

android device angle to vertical axis

http://stackoverflow.com/questions/7261732/android-device-angle-to-vertical-axis

this listener to an Orientaion Sensor SensorManager sensorManager SensorManager context.getSystemService Context.SENSOR_SERVICE.. Context.SENSOR_SERVICE Sensor sensor List Sensor sensors sensorManager.getSensorList Sensor.TYPE_ORIENTATION if sensors.size 0 sensor.. if sensors.size 0 sensor sensors.get 0 sensorManager.registerListener sensorEventListener sensor SensorManager.SENSOR_DELAY_NORMAL..

access (faster polling) accelerometer via NativeActivity NDK

http://stackoverflow.com/questions/8989686/access-faster-polling-accelerometer-via-nativeactivity-ndk

JNIEnv env jclass clazz ASensorManager sensorManager ASensorManager_getInstance ALooper looper ALooper_forThread.. accelerometerSensor ASensorManager_getDefaultSensor sensorManager ASENSOR_TYPE_ACCELEROMETER LOGI accelerometerSensor s vendor.. ASensorEventQueue queue ASensorManager_createEventQueue sensorManager looper LOOPER_ID NULL NULL ASensorEventQueue_enableSensor queue..

Android accelerometer not working when screen is turned off

http://stackoverflow.com/questions/9982433/android-accelerometer-not-working-when-screen-is-turned-off

@Override protected void onHandleIntent Intent intent sensorManager SensorManager getSystemService SENSOR_SERVICE sensorManager.unregisterListener.. SensorManager getSystemService SENSOR_SERVICE sensorManager.unregisterListener this sensorManager.registerListener this.. SENSOR_SERVICE sensorManager.unregisterListener this sensorManager.registerListener this sensorManager.getDefaultSensor Sensor.TYPE_ACCELEROMETER..

Convert magnetic field X, Y, Z values from device into global reference frame

http://stackoverflow.com/questions/15315129/convert-magnetic-field-x-y-z-values-from-device-into-global-reference-frame

import android.hardware.SensorEvent import android.hardware.SensorEventListener import android.hardware.SensorManager import android.opengl.Matrix import android.os.Bundle import android.view.View import android.widget.CheckBox import android.widget.TextView.. static final int KALMAN_STATE_MAX_SIZE 80 public static final double MEASUREMENT_NOISE 5 Sensor manager. private SensorManager mSensorManager Magnetometer spec. private TextView vendor private TextView resolution private TextView maximumRange Magnetic.. int KALMAN_STATE_MAX_SIZE 80 public static final double MEASUREMENT_NOISE 5 Sensor manager. private SensorManager mSensorManager Magnetometer spec. private TextView vendor private TextView resolution private TextView maximumRange Magnetic field coordinates..

Android Compass that can Compensate for Tilt and Pitch

http://stackoverflow.com/questions/16317599/android-compass-that-can-compensate-for-tilt-and-pitch

the azimuth and pitch from the raw TYPE_GRAVITY and TYPE_MAGNETIC_FIELD sensor data without any API calls to e.g. SensorManager.getRotationMatrix ... or SensorManager.getOrientation ... . The code could probably be improved e.g. by using a low pass.. TYPE_GRAVITY and TYPE_MAGNETIC_FIELD sensor data without any API calls to e.g. SensorManager.getRotationMatrix ... or SensorManager.getOrientation ... . The code could probably be improved e.g. by using a low pass filter if the inputs turn out to be a.. implements SensorEventListener public final static int SENSOR_UNAVAILABLE 1 references to other objects SensorManager m_sm SensorEventListener m_parent non null if this class should call its parent after onSensorChanged ... and onAccuracyChanged..

Rotate MapView in Android

http://stackoverflow.com/questions/1830391/rotate-mapview-in-android

private MapView mMapView private MyLocationOverlay mMyLocationOverlay null private boolean mModeCompass false private SensorManager mSensorManager private LinearLayout mRotateViewContainer private RotateView mRotateView @Override public void onCreate Bundle.. mMapView private MyLocationOverlay mMyLocationOverlay null private boolean mModeCompass false private SensorManager mSensorManager private LinearLayout mRotateViewContainer private RotateView mRotateView @Override public void onCreate Bundle savedInstanceState.. public void onCreate Bundle savedInstanceState super.onCreate savedInstanceState setContentView R.layout.maplayout mSensorManager SensorManager getSystemService SENSOR_SERVICE mRotateViewContainer LinearLayout findViewById R.id.rotating_view mRotateView..

Android: I want to shake it

http://stackoverflow.com/questions/2317428/android-i-want-to-shake-it

this question Here is an example code. Put this into your activity class put this into your activity class private SensorManager mSensorManager private float mAccel acceleration apart from gravity private float mAccelCurrent current acceleration including.. Here is an example code. Put this into your activity class put this into your activity class private SensorManager mSensorManager private float mAccel acceleration apart from gravity private float mAccelCurrent current acceleration including gravity.. cut filter public void onAccuracyChanged Sensor sensor int accuracy @Override protected void onResume super.onResume mSensorManager.registerListener mSensorListener mSensorManager.getDefaultSensor Sensor.TYPE_ACCELEROMETER SensorManager.SENSOR_DELAY_NORMAL..

android: turn off screen when close to face

http://stackoverflow.com/questions/3018716/android-turn-off-screen-when-close-to-face

How to detect shake event with android?

http://stackoverflow.com/questions/5271448/how-to-detect-shake-event-with-android

the SensorListener public class ShakeActivity extends Activity implements SensorListener You will need to acquire a SensorManager sensorMgr SensorManager getSystemService SENSOR_SERVICE And register this sensor with desired flags ensorMgr.registerListener.. class ShakeActivity extends Activity implements SensorListener You will need to acquire a SensorManager sensorMgr SensorManager getSystemService SENSOR_SERVICE And register this sensor with desired flags ensorMgr.registerListener this SensorManager.SENSOR_ACCELEROMETER.. getSystemService SENSOR_SERVICE And register this sensor with desired flags ensorMgr.registerListener this SensorManager.SENSOR_ACCELEROMETER SensorManager.SENSOR_DELAY_GAME In your onSensorChange method you determine whether it ™s a shake or..

android compass seems unreliable

http://stackoverflow.com/questions/6256256/android-compass-seems-unreliable

class public void onSensorChanged SensorEvent event If the sensor data is unreliable return if event.accuracy SensorManager.SENSOR_STATUS_UNRELIABLE Toast.makeText main.this Sensor Status Unreliable Toast.LENGTH_SHORT .show Gets the value of.. break case Sensor.TYPE_MAGNETIC_FIELD m_vfgeomag event.values.clone break if m_vfgravity null m_vfgeomag null if SensorManager.getRotationMatrix m_vfinR m_vfI m_vfgravity m_vfgeomag SensorManager.getOrientation m_vfinR m_vforientVals m_fCompBearing.. break if m_vfgravity null m_vfgeomag null if SensorManager.getRotationMatrix m_vfinR m_vfI m_vfgravity m_vfgeomag SensorManager.getOrientation m_vfinR m_vforientVals m_fCompBearing float Math.round Math.toDegrees m_vforientVals 0 2 2 convert to 0..

Moving an image using Accelerometer of android

http://stackoverflow.com/questions/6457768/moving-an-image-using-accelerometer-of-android

import android.hardware.SensorEvent import android.hardware.SensorEventListener import android.hardware.SensorManager import android.os.Bundle import android.view.View import android.widget.TextView public class Accelerometer extends Activity.. created. CustomDrawableView mCustomDrawableView null ShapeDrawable mDrawable new ShapeDrawable int x int y private SensorManager sensorManager null Called when the activity is first created. @Override public void onCreate Bundle savedInstanceState super.onCreate.. @Override public void onCreate Bundle savedInstanceState super.onCreate savedInstanceState Get a reference to a SensorManager sensorManager SensorManager getSystemService SENSOR_SERVICE mCustomDrawableView new CustomDrawableView this setContentView..

Android accelerometer not working when screen is turned off

http://stackoverflow.com/questions/9982433/android-accelerometer-not-working-when-screen-is-turned-off

true return lockStatic @Override protected void onHandleIntent Intent intent sensorManager SensorManager getSystemService SENSOR_SERVICE sensorManager.unregisterListener this sensorManager.registerListener this sensorManager.getDefaultSensor.. this sensorManager.registerListener this sensorManager.getDefaultSensor Sensor.TYPE_ACCELEROMETER SensorManager.SENSOR_DELAY_NORMAL synchronized this boolean run true while run try wait 1000 getLock AccelerometerService.this .acquire.. synchronized this boolean run true while run try wait 1000 getLock AccelerometerService.this .acquire sensorManager SensorManager getSystemService SENSOR_SERVICE sensorManager.unregisterListener this sensorManager.registerListener this sensorManager.getDefaultSensor..

Vintage Thermometer custom UI component + SensorSimulator (steps to test the component on the emulator)

http://stackoverflow.com/questions/10099084/vintage-thermometer-custom-ui-component-sensorsimulator-steps-to-test-the-com

had to put Context.SENSOR_SERVICE . After that the next change was private void attachToSensor SensorManagerSimulator sensorManager getSensorManager sensorManager.connectSimulator Since it seems sensorsimulator doesn't implement getSensorList I had to.. . After that the next change was private void attachToSensor SensorManagerSimulator sensorManager getSensorManager sensorManager.connectSimulator Since it seems sensorsimulator doesn't implement getSensorList I had to replace List Sensor sensors sensorManager.getSensorList.. Since it seems sensorsimulator doesn't implement getSensorList I had to replace List Sensor sensors sensorManager.getSensorList Sensor.TYPE_TEMPERATURE with Sensor sensor sensorManager.getDefaultSensor Sensor.TYPE_TEMPERATURE and to remove..

Android getOrientation() method returns bad results

http://stackoverflow.com/questions/10192057/android-getorientation-method-returns-bad-results

float mAngle1_filtered_pitch 0 float mAngle2_filtered_roll 0 private Compass3DView mCompassView private SensorManager sensorManager sensor calculation values float mGravity null float mGeomagnetic null float Rmat new float 9 float Imat new float 9 float.. mTextView_filtered_azimuth ll.addView mTextView_filtered_pitch ll.addView mTextView_filtered_roll setContentView ll sensorManager SensorManager this.getSystemService Context.SENSOR_SERVICE sensorManager.registerListener mAccelerometerListener sensorManager.getDefaultSensor.. mTextView_filtered_roll setContentView ll sensorManager SensorManager this.getSystemService Context.SENSOR_SERVICE sensorManager.registerListener mAccelerometerListener sensorManager.getDefaultSensor Sensor.TYPE_ACCELEROMETER SensorManager.SENSOR_DELAY_UI..

Gyroscope Issues with Device Orientation

http://stackoverflow.com/questions/14310347/gyroscope-issues-with-device-orientation

2 0.0f gyroMatrix 3 0.0f gyroMatrix 4 1.0f gyroMatrix 5 0.0f gyroMatrix 6 0.0f gyroMatrix 7 0.0f gyroMatrix 8 1.0f get sensorManager and initialise sensor listeners mSensorManager SensorManager this.getSystemService SENSOR_SERVICE initListeners wait for..

How to open/display documents(.pdf, .doc) without external app?

http://stackoverflow.com/questions/14578530/how-to-open-display-documents-pdf-doc-without-external-app

If i release the button i can't scroll it. So if i open the document with external app my button disappears and the sensorManager works neither. Have someone any idea to solve this problem. Or have someone any idea how to scroll the document opened in..

Rotating phone quickly 180 degrees, camera preview turns upside down

http://stackoverflow.com/questions/19532599/rotating-phone-quickly-180-degrees-camera-preview-turns-upside-down

null private Sensor mOrientaion1 int cameraId 0 public final String TAG CustomCamera private SensorManager sensorManager @Override public void onCreate Bundle savedInstanceState super.onCreate savedInstanceState requestWindowFeature Window.FEATURE_NO_TITLE.. WindowManager.LayoutParams.FLAG_FULLSCREEN setContentView R.layout.main context this sensorManager SensorManager getSystemService SENSOR_SERVICE mOrientaion1 sensorManager.getDefaultSensor Sensor.TYPE_ORIENTATION setRequestedOrientation.. setContentView R.layout.main context this sensorManager SensorManager getSystemService SENSOR_SERVICE mOrientaion1 sensorManager.getDefaultSensor Sensor.TYPE_ORIENTATION setRequestedOrientation ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE imageView ImageView..

Moving an image using Accelerometer of android

http://stackoverflow.com/questions/6457768/moving-an-image-using-accelerometer-of-android

mCustomDrawableView null ShapeDrawable mDrawable new ShapeDrawable int x int y private SensorManager sensorManager null Called when the activity is first created. @Override public void onCreate Bundle savedInstanceState super.onCreate.. public void onCreate Bundle savedInstanceState super.onCreate savedInstanceState Get a reference to a SensorManager sensorManager SensorManager getSystemService SENSOR_SERVICE mCustomDrawableView new CustomDrawableView this setContentView mCustomDrawableView.. stub @Override protected void onResume super.onResume Register this class as a listener for the accelerometer sensor sensorManager.registerListener this sensorManager.getDefaultSensor Sensor.TYPE_ACCELEROMETER SensorManager.SENSOR_DELAY_NORMAL ...and..

SensorEventListener doesn't get unregistered with unregisterListener() method

http://stackoverflow.com/questions/6919577/sensoreventlistener-doesnt-get-unregistered-with-unregisterlistener-method

it in ddms I can still see the thread android.hardware.SensorManager SensorThread Running . The registration code sensorManager SensorManager getSystemService Context.SENSOR_SERVICE List Sensor sensors sensorManager.getSensorList Sensor.TYPE_ORIENTATION.. . The registration code sensorManager SensorManager getSystemService Context.SENSOR_SERVICE List Sensor sensors sensorManager.getSensorList Sensor.TYPE_ORIENTATION if sensors.size 0 sensor sensors.get 0 running sensorManager.registerListener sensorEventListener.. List Sensor sensors sensorManager.getSensorList Sensor.TYPE_ORIENTATION if sensors.size 0 sensor sensors.get 0 running sensorManager.registerListener sensorEventListener sensor SensorManager.SENSOR_DELAY_FASTEST and unregistration try if sensorManager null..

android device angle to vertical axis

http://stackoverflow.com/questions/7261732/android-device-angle-to-vertical-axis

the one from the center of the device to its top Then I register this listener to an Orientaion Sensor SensorManager sensorManager SensorManager context.getSystemService Context.SENSOR_SERVICE Sensor sensor List Sensor sensors sensorManager.getSensorList.. sensorManager SensorManager context.getSystemService Context.SENSOR_SERVICE Sensor sensor List Sensor sensors sensorManager.getSensorList Sensor.TYPE_ORIENTATION if sensors.size 0 sensor sensors.get 0 sensorManager.registerListener sensorEventListener.. sensor List Sensor sensors sensorManager.getSensorList Sensor.TYPE_ORIENTATION if sensors.size 0 sensor sensors.get 0 sensorManager.registerListener sensorEventListener sensor SensorManager.SENSOR_DELAY_NORMAL else notify the user that there's no orientation..

access (faster polling) accelerometer via NativeActivity NDK

http://stackoverflow.com/questions/8989686/access-faster-polling-accelerometer-via-nativeactivity-ndk

but nothing happen void Java_azka_web_ndk_AcceleroNDKActivity_startMonitoring JNIEnv env jclass clazz ASensorManager sensorManager ASensorManager_getInstance ALooper looper ALooper_forThread if looper NULL looper ALooper_prepare ALOOPER_PREPARE_ALLOW_NON_CALLBACKS.. ALooper_prepare ALOOPER_PREPARE_ALLOW_NON_CALLBACKS ASensorRef accelerometerSensor ASensorManager_getDefaultSensor sensorManager ASENSOR_TYPE_ACCELEROMETER LOGI accelerometerSensor s vendor s ASensor_getName accelerometerSensor ASensor_getVendor accelerometerSensor.. accelerometerSensor ASensor_getVendor accelerometerSensor ASensorEventQueue queue ASensorManager_createEventQueue sensorManager looper LOOPER_ID NULL NULL ASensorEventQueue_enableSensor queue accelerometerSensor ASensorEventQueue_setEventRate queue..

Android accelerometer not working when screen is turned off

http://stackoverflow.com/questions/9982433/android-accelerometer-not-working-when-screen-is-turned-off

NAME lockStatic.setReferenceCounted true return lockStatic @Override protected void onHandleIntent Intent intent sensorManager SensorManager getSystemService SENSOR_SERVICE sensorManager.unregisterListener this sensorManager.registerListener this.. @Override protected void onHandleIntent Intent intent sensorManager SensorManager getSystemService SENSOR_SERVICE sensorManager.unregisterListener this sensorManager.registerListener this sensorManager.getDefaultSensor Sensor.TYPE_ACCELEROMETER SensorManager.SENSOR_DELAY_NORMAL.. Intent intent sensorManager SensorManager getSystemService SENSOR_SERVICE sensorManager.unregisterListener this sensorManager.registerListener this sensorManager.getDefaultSensor Sensor.TYPE_ACCELEROMETER SensorManager.SENSOR_DELAY_NORMAL synchronized..