Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6017993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:12:34+00:00 2026-05-23T03:12:34+00:00

I have a Galaxy Tab 1000. I am trying to write a code, that

  • 0

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


  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:12:35+00:00Added an answer on May 23, 2026 at 3:12 am

    I am a little confused of what exactly it is that you want to do, but from what I take you want to get acceleration data in your onSensorChanged. Your on create looks fine, however you can check if they are registering the listener correctly by checking the bool that returns from the registerListener. Heres what i do when listening for an event and retrieving the values returned.

        @Override
        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();
                return;
            }
    
    
            // Gets the value of the sensor that has been changed
            switch (event.sensor.getType())
            {
            case Sensor.TYPE_ACCELEROMETER:
                m_vAccel = event.values.clone();
                break;
            }
    

    Other wise you can also use the Linear Acceleration sensor which is the same as the accelerometer returns minus
    gravity. http://developer.android.com/reference/android/hardware/SensorEvent.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to troubleshoot this by capturing any storage events that remove values
I am trying to troubleshoot this by capturing any storage events that remove values
I have a Samsung Galaxy Tab (Android 2.2 Froyo, etc) that I am developing
I am having a problem. I have a galaxy tab that comes with 16gb
Have you guys had any experiences (positive or negative) by placing your source code/solution
I have an app that runs fine on my Galaxy S2 and many other
I have recently been working with C2DM on a Samsung Galaxy Tab 10.1 running
I have started coding for mobile browsers (i.e. iPad, Galaxy Tab, etc). For a
I have recently purchased a Samsung Galaxy Tab as an Android 2.x testbed (I
Device: Samsung Galaxy Tab I followed this guide: http://developer.android.com/resources/articles/window-bg-speed.html I put the background image

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.