Amit Samel wrote:
> Hello guys,
> i am very much new to android platform. i am trying to implement some
> codes from Android: A Programmer’s Guide. i have installed latest sdk
> thats why there are some issues regarding deprecated apis. when i was
> trying to call getCurrentLocation() i got error , that this method is
> not supported by LocationManager.So i had replaced it by
> getLastKnownLocation . but it got crashed. can any one knows why is
> this happening?
> this is my code.
> LocationManager myManager = (LocationManager)
> getSystemService(Context.LOCATION_SERVICE);
> Double latPoint = myManager.getLastKnownLocation("gps").getLatitude
> ();
> Double lngPoint = myManager.getLastKnownLocation("gps").getLongitude
> ();
> thanks .
You may be missing the appropriate permissions (e.g.,
ACCESS_FINE_LOCATION) in your AndroidManifest.xml file.
Note that location tracking changed fairly substantially between the M5
SDK from this summer and the current SDK.
--
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 1.9 Published!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---