Fake GPS for Android in virtual box

I am trying to virtualize a GPS device in android running in a virtual box. I want an app running in android to use a gps device or somehow create a fake gps location. I started to study the source code of the Android emulator, but meanwhile anyone has a good place to start.

[UPDATE]

To make it more understandable, the entire application stack will look something like this:

Android app (with gps functionality) to be tested ----> (developed by end user)

Android virtual machine ----> (Guest OS)

virtual box ----> 

Microsoft Windows ---> Host OS 

Now, ideally, I would like my application (for example, adbor ddms) to work in Windows, from where the user could set some coordinate values ​​for the GPS device (in the absence of actual GPS, as well as virtualize the existing GPS). These coordinates will be available for the Android application. Basically, this is the same as the functionality of an existing Android emulator (using ddms) through virtual-box, which executes an android image.

I DO NOT run the Android emulator and I do not use eclipse. :( [UPDATE ENDS]

Thank you Vikram.

+3
source share
4 answers

Here's how I did it (and a brief overview of how the Android builder works (works on vbox)).

Android-, GPS, ( libgps.so libhardware_legacy.so) JNI ( frameworks/base/core/jni/android_location_GpsLocationProvider.cpp)

GPS ( gps) .

, Android -> VBox -> Windows

enter image description here

, , :

  • libgps.so gps_get_interface ( gps.h), JNI. gps , libgps.so, GpsLocationProvider.

  • Vbox , host service, . ioctl ioctl- (: VBOX_GUEST_IOCTL_HGCM_CONNECT ..).

  • ( DLL, VBox Host Service), , HGCM, , , 2.

  • , - / , Android VM, host service, VBox Additionslibgps.soGpsLocationProvider service → , , App with GPS Support.

, - - - , Android.

. hgcm- android lib - , android libc ( libs). , (/dev/vboxguest) ioctl , vbox, .

+6

? , ddms .

+1

If you are using eclipse, go to the DDMS page, then go to the "Managing the emulator" section. There you will see 2 text fields for latitude and longitude. Then you click "Submit" and this information will be sent to the emulator.

Alternatively, you can use telnet in the emulator to transmit GPS information: telnet localhost 5554 geo fix -82.411629 28.054553 example

http://www.devx.com/wireless/Article/39239/1954

0
source

All Articles