martes, 8 de noviembre de 2011

Usar el Acelerometro con el emulador de Android

Para poder usar el acelerometro hayq ue bajarse un par de programas.
Uno se ejecuta en el PC y otro se instala en el emulador. Ambos se comunican supongo que por TCP.

Connecting the SensorSimulator with the Android emulator
    http://code.google.com/p/openintents/wiki/SensorSimulator
    Download the latest sensorsimulator-x.x.x.zip from the download tab and unzip (if you didn't already).
    Start bin/sensorsimulator-x.x.x.jar (Java standalone application).
    Install bin/SensorSimulatorSettings-x.x.x.apk on your Android emulator.
  http://blog.freewarelovers.com/2010/08/how-to-install-apk-files-on-android.html
  Ok, now start the console ("Start -> Run... -> type 'cmd'" for Windows computers). Type-in the following command: adb install $APK where $APK is the name of the APK file. For example: adb install Snake.apk

Launch SensorSimulator on the emulator.
    Enter IP address and socket (port) number into the emulator as shown by the SensorSimulator (see below).
Go to Sensors Tab in the java simulator and choose the sensors you want to enable.
Press Connect on the emulator (second tab of the settings activity).
Now you should see the sensor data (see below). With a small delay, they are in sync with the SensorSimulator numbers.
Try moving the SensorSimulator phone around with the mouse: The numbers will change in the SensorSimulator and on the Android phone.

No hay comentarios:

Publicar un comentario