Firstly I got the question why I can't get the current location any
more. I don't need repeating updates of my position I just need the
current location. At the moment I'm using getLastKnownLocation() but I
would assume that this position could be very outdated.
Furthermore the method "getLastKnownLocation()" returns me a Location
object that is null. Here is the code that I'm using at the moment:
LocationManager lM =
(LocationManager)context.getSystemService(context.LOCATION_SERVICE);
LocationProvider lP = lM.getProvider("gps");
Location loc = lM.getLastKnownLocation(lP.getName());
String[] location =
{String.valueOf(loc.getLongitude()),String.valueOf(loc.getLatitude())};
I've added the following permission to my manifest file:
<uses-permission
android:name="android.permission.ACCESS_LOCATION" />
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission
android:name="android.permission.ACCESS_MOCK_LOCATION" />
But I'm always getting a Nullpointer Exception using the Location. (so
the Location returned is null)
Could you give me a hint how I could achieve to get my current/
lastKnown location in 0.9? (in M5 everything was fine)
Looking forward getting your answers.
Regards and happy coding!
--~--~---------~--~----~------------~-------~--~----~
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]
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
-~----------~----~----~----~------~----~------~--~---