1. Download our Official Android App: Forums for Android!

Apps Working with Sensor

Discussion in 'Android Development' started by saariko, Jun 7, 2011.

  1. saariko

    saariko Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Jun 7, 2011

    Jun 7, 2011
    2
    0
    5
    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.
    Code (Text):
    1.  
    2. OnCreate()
    3.         mySensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
    4.         mySensorManager.registerListener(mySensorEventListener, mySensorManager
    5.                 .getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
    6.                 SensorManager.SENSOR_DELAY_NORMAL); //

    This is the sensor onsensorchanged implementation (very simple I think) but not working
    Code (Text):
    1.             if (event.sensor.getType() == SensorManager.SENSOR_ACCELEROMETER)
    2.                 // Do WORKL


    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


    ------
     

    Advertisement

  2. kmkcge

    kmkcge Lurker
    Rank:
    None
    Points:
    5
    Posts:
    1
    Joined:
    Aug 5, 2011

    Aug 5, 2011
    1
    0
    5
    Hi,

    I can help with this but am wondering if this is still an active thread. Can you let me know if you are still monitoring for responses?
     

Share This Page

Loading...