When I try using the "gps" provider, I get the following:

ERROR/AndroidRuntime(3253): Caused by: java.lang.NullPointerException
ERROR/AndroidRuntime(3253):     at
android.location.LocationManager.createProvider(LocationManager.java:
61)
ERROR/AndroidRuntime(3253):     at
android.location.LocationManager.getProvider(LocationManager.java:119)
ERROR/AndroidRuntime(3253):     at
net.lbns.mobileclient.util.LocationUtil.getLocationProvider(LocationUtil.java:
21)

Code:

public static LocationProvider getLocationProvider(Application app) {
    try {
      LocationManager locationManager = getLocationManager(app);
      return locationManager.getProvider("gps");
    }
    catch (SecurityException e) {
      return null;
    }
  }

  public static LocationManager getLocationManager(Application app) {
    return (LocationManager)
app.getSystemService(Context.LOCATION_SERVICE);
  }

The application is retrieved by using getApplication() of a sub-
activity. Any help?
--~--~---------~--~----~------------~-------~--~----~
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 M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to