Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5987705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:51:14+00:00 2026-05-22T22:51:14+00:00

I am trying to virtualize GPS device in android running in virtual-box. I want

  • 0

I am trying to virtualize GPS device in android running in virtual-box. I want to facilitate an app running in android to use the gps device or get a fake gps location some how. I have started looking at the android emulator source code but meanwhile, any one has any good place to start with.

[UPDATE]

To make it a bit more clear, the whole application stack would be some thing like:

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 to have my application (like adb or ddms) running in Windows from where the user can set some coordinate values for gps device (in absence of actual GPS, else virtualize the existing GPS) . These coordinates would be available to the android app. Basically, this is same as providing the functionality of existing android emulator (using ddms) through virtual-box running an android image.

I am NOT running android emulator and I am not using eclipse. 🙁
[UPDATE ENDS]

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:51:15+00:00Added an answer on May 22, 2026 at 10:51 pm

    This is how I did it (and a brief overview of how android stack (running on vbox) works).

    An Android app having GPS functionality, registers some callbacks with the underlying implementation of user mode shared lib (typically libgps.so or libhardware_legacy.so) using JNI interfaces (as exported in frameworks/base/core/jni/android_location_GpsLocationProvider.cpp)

    These registered callbacks are responsible for notifying GPS fix (or change in gps location) to the app.

    Here is a simple image demonstrating call flow from Android -> VBox -> Windows

    enter image description here

    Now to complete this flow, following steps were required:

    1. I created my own libgps.so exporting the function gps_get_interface (declared in gps.h), which is used by JNI interface. An app with gps support gets the latest coordinates returned from this libgps.so, which is actually loaded dynamically by the GpsLocationProvider service.

    2. Create one more shared object using Vbox headers and containing routines to connect, disconnect, and send function request to the host service, running in host OS. These are simple ioctl calls with pre-defined ioctl-numbers (eg: VBOX_GUEST_IOCTL_HGCM_CONNECT etc).

    3. Create a host service (which actually is a DLL, loaded by VBox Host Service) with can handle the parameters passed from HGCM calls and return the required data in a format that the shared object created in step 2 understands.

    4. Now to send any fake/dummy location back to an app running inside Android VM, you just need to notify the host service, and the rest is communicated back to VBox Additions -> libgps.so -> GpsLocationProvider service -> and finally to the App with GPS Support.

    Hope this will help some one trying some thing similar or help some one understanding how android stack works.

    NOTE: Compiling the hgcm code and linking it with android lib is also a bit complicated because of the limited number of functions implemented in android libc (and some other libs as well). To avoid this all, you can directly open the device (/dev/vboxguest) and issue ioctl calls on it in the format that is known to vbox and your host service.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to get my css / C# functions to look like this: body {
Trying to create a QtRuby application, I get the following error: /usr/lib64/ruby/site_ruby/1.8/Qt/qtruby4.rb:2144: [BUG] Segmentation
After trying and failing to get my hands on a temporary Mac to develop
There is a debate going in our department to virtualize Visual Studio into App-V,
I am trying to get the summary of an article and download it as
I'm trying to write test harness for part of my Android mapping application. I
I'm trying to use Google chart tools to visualize data on my site. The
Is taskset for CPU affinity applicable when trying to use L2 cache efficiently on
Trying to use this following script to load a page so that I can
trying to learn windows programming in java, want to display a image to a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.