Hi. I have been playing with mock location providers for the last
couple of days.. but found out that my application only works in 1.5
The following code only works in 1.5
If i run it in 2.1 or 1.6 it just force closes.
Location location = new Location("gps");
location.setLatitude(lat);
location.setLongitude(lng);
locationManager.setTestProviderLocation("gps", location);
After doing some test i found out that it happens whenever you access
"gps".
But if i create my own TestProvider it wont use it for gps location in
google maps.
The following code works, it runs, but google maps still uses the
default "gps" provider for gps fix.
If i remove or disable the "gps" provider the google maps app will
just use cell towers, and no gps.
if (locationManager.getProvider("spoof") == null) {
locationManager.addTestProvider("spoof", false, true, false,
false, false, false, false, 0, 5);
locationManager.setTestProviderEnabled("spoof", true);
}
Location loc = new Location("spoof");
loc.setTime(System.currentTimeMillis());
loc.setLatitude(latitude);
loc.setLongitude(longitude);
locationManager.setTestProviderLocation("spoof", loc);
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en