mock GPS

Put your problem here if it does not fit any of the other categories.

mock GPS

Postby yaniv » Thu Mar 20, 2008 1:37 pm

Hey,

I want to build an application that using GPS.
How can I fake the points that the GPS returns?
I heard there is a mock GPS, How can I install / use it?

Thanx
yaniv
Freshman
Freshman
 
Posts: 2
Joined: Thu Mar 20, 2008 1:31 pm

Top

Postby gustavo » Fri Mar 21, 2008 1:04 am

Hi Yaniv,

You have to use a LocationProvider and set getProvider method with "gps", this is the mock provider, and it simulates a ride near from San Francico. You will still have to set locationManager.requestUpdates as shown below:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.            // get a hangle on the location manager
  2.  
  3.            locationManager =
  4.  
  5.              (LocationManager) getSystemService(Context.LOCATION_SERVICE);
  6.  
  7.  
  8.  
  9.            // get the "gps" mock provider
  10.  
  11.            LocationProvider provider = locationManager.getProvider("gps");
  12.  
  13.  
  14.  
  15.            // register our IntentReceiver as an observer.
  16.  
  17.            registerReceiver(new handleLocationUpdate(), new IntentFilter(UPDATE_LOC));
  18.  
  19.  
  20.  
  21.            // instruct the location manager to broad cast the UPDATE_LOC intent
  22.  
  23.            // continually as we move.
  24.  
  25.            Intent intent = new Intent(UPDATE_LOC);
  26.  
  27.            locationManager.requestUpdates(provider, 0, 0, intent);
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


Regards, Gustavo Avila.
gustavo
Junior Developer
Junior Developer
 
Posts: 12
Joined: Sun Mar 02, 2008 2:55 pm

Postby kiran » Fri Mar 21, 2008 4:37 am

Hi,

For usign a mock GPS, create a kml file of the required route in Google earth and place this inside the /data/misc/location/gps/ folder in the enulator. Now the emulator will provide you with values along this route.

Regards,
Kiran.
:) smile it is the key that fits the lock of everybody's heart
User avatar
kiran
Experienced Developer
Experienced Developer
 
Posts: 78
Joined: Thu Nov 22, 2007 11:36 am
Location: India

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google Feedfetcher and 13 guests