Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i simulate accelerometer in android emulator? [closed]

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?

like image 330
sruthi Avatar asked Oct 13 '10 07:10

sruthi


People also ask

Can we use gyro on emulator?

I don't think there is any Gyroscope support in the Emulator. The gyroscope cannot be emulated based on magnetometers and accelerometers, as this would cause it to have reduced local consistency and responsiveness. It must be based on a usual gyroscope chip.

How do I simulate my Android phone?

Emulator for native development with Android StudioIn the Android Studio toolbar, select your app from the run configurations drop-down menu. From the target device drop-down menu, select the device that you want to run your app on. Select Run ▷. This will launch the Android Emulator.


1 Answers

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 

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

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

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

like image 54
Owen Fraser-Green Avatar answered Oct 05 '22 08:10

Owen Fraser-Green