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

有帮助吗?

解决方案

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

其他提示

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top