put <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> in your AndroidManifest.xml
On Nov 13, 9:08 pm, Arun <[email protected]> wrote: > I use Android 1.5 on HTC Hero. I've a mapapp that needs GPS > functionality. Sometimes when I start up the application I get the > following error. > 11-13 17:49:50.709: ERROR/AndroidRuntime(1585): > java.lang.RuntimeException: Unable to start activity ComponentInfo > {test.android.mapapp/test.android.mapapp.MapsActivity}: > java.lang.SecurityException: Requires ACCESS_FINE_LOCATION permission > > Code at that point is: > LocationManager lm = (LocationManager) getSystemService > (Context.LOCATION_SERVICE); > > //Send current location messages to the listener every second. > MyLocationListener listener = new MytLocationListener(); > lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, > 1, listener); > > MyLocationListener implements LocationListener. > > In the manifest file, I've selected both fine and coarse as follows: > <uses-permission > android:name="android.permission.ACCESS_FINE_LOCATION" /> > > <uses-permission > android:name="android.permission.COARSE_FINE_LOCATION" /> > > I check that "Enable GPS sateliites" setting is checked. > One more piece of information. Whenever I get the error, I reinstall > the application, it works ok. > > Google Maps works fine. What is wrong with my code? -- 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

