Shake the device to launch an application in Android

a 夏天 提交于 2019-11-29 14:55:22

问题


How can we launch a application by just shaking the device? I want to do something similar to the app "Appshaker".


回答1:


From an activity, you can use the SensorManager to detect a shake, then react to that shake. That is what AppShaker does. Here is a sample project demonstrating one way to detect a shake.



来源:https://stackoverflow.com/questions/5803370/shake-the-device-to-launch-an-application-in-android

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!