摇动设备推出的Andr​​oid应用程序应用程序、设备、Andr、oid

2023-09-05 09:41:45 作者:齐眉念别离

我们如何可以启动,只需摇动设备的应用程序?我想要做类似的应用程序Appshaker的东西。

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

推荐答案

从一个活动,您可以使用的SensorManager 来检测抖动,随即反应过来该抖动。这就是AppShaker一样。 这里是展示一种方法来检测抖动的示例项目。

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.