我如何在 android 模拟器中模拟加速度计? [英] How can i simulate accelerometer in android emulator?

查看:52
本文介绍了我如何在 android 模拟器中模拟加速度计?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在没有 Android 手机.但在我的应用程序中,我需要使用加速度计值.如何在模拟环境中执行此操作?

I don't have an Android phone right now. But in my application I need to use the accelerometer values. How can I do this in a simulated environment?

推荐答案

Android 模拟器本身不支持它,但 OpenIntents 的 SensorSimulator 填补了空白.下载并解压 zip 文件,然后启动独立的 jar 文件:

The Android emulator doesn't support it itself but OpenIntents' SensorSimulator fills the void. Download and unpack the zip file, then start the standalone jar file:

$ java -jar bin/sensorsimulator.jar

接下来,使用 SDK 附带的 adb 工具在模拟器上安装 SensorSimulatorSettings:

Next, install SensorSimulatorSettings on the emulator using the adb tool which comes with the SDK:

$ adb -s <emulator device> install bin/SensorSimulatorSettings.apk

(运行 adb devices 以查找模拟器设备名称).最后,在模拟器中运行已安装的 SensorSimulatorSettings 应用程序并输入 IP 地址 10.0.2.2(尽管 SensorSimulator 应用程序可能会建议.这是开发主机环回设备的别名,因此应该始终是有效.

(run adb devices to find the emulator device name). Finally, run the installed SensorSimulatorSettings app in the emulator and enter the IP address 10.0.2.2 (despite what the SensorSimulator application might suggest. This is an alias to the loopback device of the development host so should always be valid.

这篇关于我如何在 android 模拟器中模拟加速度计?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆