The code I am using to get the location is very simple: LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); loc = lm.getLastKnownLocation(lm.getBestProvider(new Criteria(), true));
When I get the location, it's always a "network" location. If I hard code it and replace "lm.getBestProvider(new Criteria(), true)" with "gps" the application crashes. Bobbie On Nov 4, 7:53 am, Mark Murphy <[EMAIL PROTECTED]> wrote: > Bobbie wrote: > > I have the latest SDK download and the SDK throws errors when I try to > > use "getCurrentLocation", I can only use "getLastKnownLocation" and > > can only get a "network" location, can't even get a GPS location > > (which is what I want)... > > It works just fine with GPS. > > > What's the deal here? Was this deprecated or something? > > getCurrentLocation() was removed. My guess is that they didn't want this > to be a blocking call, waiting for GPS to get a fix. > > > I have tried sample code and everything and it throws > > > an error before I can even launch the code...? > > You didn't provide us with the error message. You didn't provide us with > sample source code that raises the error message. As a result, it is > somewhat difficult to provide concrete assistance. > > Generally speaking, you need to do two things: > > 1. Ensure you have the appropriate permissions (e.g., > ACCESS_FINE_LOCATION) in your AndroidManifest.xml file. > > 2. Ensure somebody is asking your desired location provider for updates, > otherwise getLastKnownLocation() may be perpetually null. > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > > Android Training on the Ranch! -- Mar 16-20, > 2009http://www.bignerdranch.com/schedule.shtml --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

