Screen Always On, PowerManager, WakeLock, Backlight

Quickly share your Android Code Snippets here...

Re: Screen Always On, PowerManager, WakeLock, Backlight

Postby zuerst » Thu Nov 03, 2011 9:12 am

I have a Galaxy Tab 1000.I am trying to write a code, that will identify ANY movement.I have version 2.2 on the phone.This is the oncreate code.
OnCreate()
mySensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
mySensorManager.registerListener(mySensorEventListener, mySensorManager
.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
SensorManager.SENSOR_DELAY_NORMAL); //

This is the sensor onsensorchanged implementation (very simple I think) but not working
if (event.sensor.getType() == SensorManager.SENSOR_ACCELEROMETER) // Do WORK
The event.sensor.getType() returns 1
If I do: getSensorList(Sensor.TYPE_ALL); I get sensors compass, compass, BMA150 (accel), temp, magnet, proximity, light and Gyro.

(weird - I thought it's only up in 3.0)

Please advise, how can I get motion detection on the phone.
thanks
zuerst
Freshman
Freshman
 
Posts: 4
Joined: Wed Nov 02, 2011 8:06 am

Top
Previous

Return to Code Snippets for Android

Who is online

Users browsing this forum: No registered users and 4 guests