Frage

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".

War es hilfreich?

Lösung

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

Andere Tipps

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top