I've posted with no help, please help me out. I am trying to figure
out how to get the GPS location of my device. However, when I use the
code below (see "CODE TO GET LOCATION") my Android application
crashes. I am developing on the G1 phone. If I change the provider
to "network" instead of "gps", it works perfectly fine. Here is the
code I am using:
** ANDROID MANIFEST PERMISSIONS **
<uses-permission android:name="android.permission.ACCESS_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission
android:name="android:permission.ACCESS_FINE_LOCATION" />
** CODE TO GET LOCATION **
LocationManager lM = (LocationManager)
getSystemService(Context.LOCATION_SERVICE);
LocationProvider lP = lM.getProvider("gps");
Location loc = lM.getLastKnownLocation(lP.getName());
Do I have to somehow tell the GPS to try to get a fix? If so, how do
I go about that?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---