Question

When music is played in GalaxyS3 (or S4, etc…), if phone is filled upside down, the music is stopped. at this moment, which sensor exactly sensing the "flipping".

Was it helpful?

Solution

Sample Code to detect phone flipping could look like this: http://android-er.blogspot.in/2011/02/detect-phone-flipping.html

So basically you should use the accelerometer of your smartphone and place your custom code to onSensorChanged

OTHER TIPS

The accelerometer of the phones can be used to determine the orientation of the phone (when it does not move). This sensor is used to change the screen orientation when you rotate your device, and also to stop the music when you flip it.

For more information on the sensors in your Android device, see: Sensors overview

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top