-1

Hello friends in my app I want to put sensor like when I rotate mobile from north to south at this time sensor is called, for that I see TYPE_GYROSCOPE is used but I don't know exactly how it can be used for my app

Please give any example for when I rotate my phone from north to south that sensor type is called. I have used the following

  @Override
public void onSensorChanged(SensorEvent event) {
                 if (event.sensor.getType() == Sensor.TYPE_GYROSCOPE) {
         // code here
    }
    }

but if is not true always so not get pointer to the inside if body

Rachita Nanda
  • 4,509
  • 9
  • 42
  • 66
Nirav Mehta
  • 1,715
  • 4
  • 23
  • 42

2 Answers2

0

You can go through the How to use Gyroscope Sensor in Android

Also check out the Here for all the sensors detail.

GrIsHu
  • 29,068
  • 10
  • 64
  • 102
0

I found my answers, For this of movement Sensor.TYPE_GYROSCOPE is not used instead i used Sensor.TYPE_ACCELEROMETER it usefull to found x and y co-ordinate as mobile change its orientation like movement or north to south. now this working weell for my apps.

Nirav Mehta
  • 1,715
  • 4
  • 23
  • 42