Tag Archives: Acceleration

How to use Accelerometer in Android?

By | May 30, 2012

This is a simple post showing how to use accelerometer in android. This java code prints the values of x,y and z axis in the console. [java] package com.coderzheaven.pack; import android.app.Activity; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.os.Bundle; public class AccelerometerTest extends Activity implements SensorEventListener{ private SensorManager sensorManager; double ax,ay,az; // these are the acceleration… Read More »

How to detect shake in iPhone ? An example

By | April 13, 2011

Hi, Sometimes you may want to detect shake gesture in iPhone using your programs. But how can you detect shake gesture in iPhone? Shake gesture in iPhone can be detected by using the accelerometer. The following lines of code can be used for detecting the shake gesture in iPhone. You can use these lines of code in your… Read More »