문제

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