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

  • SEARCH
  • Home
  • 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 1111665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:35:01+00:00 2026-05-17T02:35:01+00:00

how to find out mobile turn left and right.depending on left and right turn

  • 0

how to find out mobile turn left and right.depending on left and right turn i need to one ball?

  • 1 1 Answer
  • 1 View
  • 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-17T02:35:01+00:00Added an answer on May 17, 2026 at 2:35 am

    You need to implement SensorListener to detect phone shaking.

    // Need to implement SensorListener
    public class ShakeActivity extends Activity implements SensorListener {
        // For shake motion detection.
        private SensorManager sensorMgr;
        private long lastUpdate = -1;
        private float x, y, z;
        private float last_x, last_y, last_z;
        private static final int SHAKE_THRESHOLD = 800;
    
        protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
            ...... // other initializations
        // start motion detection
        sensorMgr = (SensorManager) getSystemService(SENSOR_SERVICE);
        boolean accelSupported = sensorMgr.registerListener(this,
            SensorManager.SENSOR_ACCELEROMETER,
            SensorManager.SENSOR_DELAY_GAME);
    
        if (!accelSupported) {
            // on accelerometer on this device
            sensorMgr.unregisterListener(this,
                    SensorManager.SENSOR_ACCELEROMETER);
        }
        }
    
        protected void onPause() {
        if (sensorMgr != null) {
            sensorMgr.unregisterListener(this,
                    SensorManager.SENSOR_ACCELEROMETER);
            sensorMgr = null;
            }
        super.onPause();
        }
    
        public void onAccuracyChanged(int arg0, int arg1) {
        // TODO Auto-generated method stub
        }
    
        public void onSensorChanged(int sensor, float[] values) {
        if (sensor == SensorManager.SENSOR_ACCELEROMETER) {
            long curTime = System.currentTimeMillis();
            // only allow one update every 100ms.
            if ((curTime - lastUpdate) > 100) {
            long diffTime = (curTime - lastUpdate);
            lastUpdate = curTime;
    
            x = values[SensorManager.DATA_X];
            y = values[SensorManager.DATA_Y];
            z = values[SensorManager.DATA_Z];
    
            float speed = Math.abs(x+y+z - last_x - last_y - last_z)
                                  / diffTime * 10000;
            if (speed > SHAKE_THRESHOLD) {
                // yes, this is a shake action! Do something about it!
            }
            last_x = x;
            last_y = y;
            last_z = z;
            }
        }
        }
    }
    

    Have a look at the tutorial, detect shake motion

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

Sidebar

Related Questions

i need to find out automationid for key board values? how to send keystrokes
I'm trying to find out the type of message store on windows mobile devices
One that I know of is User Agent detection to find out the device.
Find out the time complexity (Big Oh Bound) of the recurrence T(n) = T(⌊n⌋)
To find out the start command for mysqld (using a mac) I can do:
I find out how to replace the busy cursor here: http://livedocs.adobe.com/flex/3/html/cursormgr_3.html However, how do
To find out if some important functions were removed (and without doing a lot
I am trying to find out how to write an SQL statement that will
I recently find out that wpf handles INotifyPropertyChanged in two different ways. I just
I would like to find out which version of an executable the CMD shell

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.