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?
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?
The recent version of emulator comes enabled with Accelerometer and other sensor simulation support. One can telnet localhost 5554:
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Android Console: type 'help' for a list of commands
OKsensor
allows you to request the emulator sensorsavailable sub-commands:
status list all sensors and their status.
get get sensor values
set set sensor valuesKO: missing sub-command
sensor status
acceleration: enabled.
magnetic-field: enabled.
orientation: enabled.
temperature: enabled.
proximity: enabled.
OK
How exactly to simulate a shake, I don't know. Try sending these two commands one after the other rapidly:
sensor set acceleration 0:0:0
sensor set acceleration 99:99:99