Well, your code does work for me, although I'm not sure what you are
trying to do here...
> The application is retrieved by using getApplication() of a sub-
> activity.
That might be the problem.
On Apr 7, 4:22 pm, NTR <[EMAIL PROTECTED]> wrote:
> The permissions are:
>
> <uses-permission android:name="android.permission.ACCESS_GPS" />
> <uses-permission
> android:name="android.permission.ACCESS_ASSISTED_GPS" />
> <uses-permission android:name="android.permission.ACCESS_LOCATION"/>
>
> Anything missing?
>
> Dan U. wrote:
> > have you set proper uses-permission settings in androidmanifest.xml?
>
> > On Apr 6, 5:36 pm, NTR <[EMAIL PROTECTED]> wrote:
> > > I even tried running "emulator -wipe-data" again, but it didn't
> > > help...
>
> > > NTR wrote:
> > > > 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
-~----------~----~----~----~------~----~------~--~---