Here is what i have done: private void setTestLocation(double lat, double lng) { Location location = new Location("gps"); location.setLatitude(lat); location.setLongitude(lng); locationManager.setTestProviderLocation("gps", location); }
Using LocationManager.GPS_PROVIDER is better style, i guess, but calling this with: setTestLocation(40.738412973944534,-73.98468017578125); takes your emulator straight to Manhattan. :-) The tools that come with 0.9 beta seem to be broken, so using KML/GPX replay via eclipse does not work (at least for me and some other people). On 25 Aug., 21:23, CG <[EMAIL PROTECTED]> wrote: > Hi, > > I'd just like to create to get alocation(not tracking, just get the > last postion fixed), but for my mocklocationprovider, I'd like this > fix change time to time. > > I tried the old method by creating a new directory under thelocation > directory but it seems it does not work anymore (as documented by the > way :-) ). > > I also add the test providers with the method : > public static void addMyMockLocationProvider(LocationManager locmgr) { > > String mocLocationProvider = LocationManager.GPS_PROVIDER; > > if (locmgr.getProvider(mocLocationProvider) == null || ! > locmgr.isProviderEnabled(mocLocationProvider)) { > locmgr.addTestProvider(mocLocationProvider, false, > false, false, > false, false, false, false, 0, 5); > locmgr.setTestProviderEnabled(mocLocationProvider, > true); > } > > } > > But I still don't have the position given in KML file I send thanks to > DDMS (or even GPX files) (I import files and then push on the "PLAY" > button when clickable). > > I have the folowing error in the logcat: > 08-25 19:11:30.926: ERROR/LocationManagerService(52): > isProviderEnabled got exception: > 08-25 19:11:30.926: ERROR/LocationManagerService(52): > java.lang.IllegalArgumentException: provider=network > 08-25 19:11:30.926: ERROR/LocationManagerService(52): at > com.android.server.LocationManagerService._isProviderEnabled(LocationManagerService.java: > 1145) > 08-25 19:11:30.926: ERROR/LocationManagerService(52): at > com.android.server.LocationManagerService.isProviderEnabled(LocationManagerService.java: > 1131) > 08-25 19:11:30.926: ERROR/LocationManagerService(52): at > android.location.ILocationManager > $Stub.onTransact(ILocationManager.java:211) > > I can't also succeed in having my currentlocationin the standard > maps application. The system still returns 0, 0 ! > > Does anyone here can provide a quick step by step solution to have a > mocklocationprovider working ? > > Thx ! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new Android 0.9 SDK beta! http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---