Hi,
I tried using both getLastKnownLocation and requestLocationUpdates to
get GPS coordinates from emulator.
lm= (LocationManager)getSystemService(Context.LOCATION_SERVICE);
after that, i tried:
Location loc = lm.getLastKnownLocation("gps");
-or-
LocationProvider lp = lm.getProvider("gps");
Location loc = lm.getLastKnownLocation(lp.getName());
-or-
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
locationListener);
I get the same error for all three:
D/AndroidRuntime( 693): Shutting down VM
W/dalvikvm( 693): threadid=3: thread exiting with uncaught exception
(group=0x4001aa28)
E/AndroidRuntime( 693): Uncaught handler: thread main exiting due to
uncaught exception
E/AndroidRuntime( 693): java.lang.RuntimeException: Unable to start
activity ComponentInfo{com.geekdroid/com.geekdroid.BlogSend}:
java.lang.SecurityException:
Requires ACCESS_FINE_LOCATION permission
E/AndroidRuntime( 693): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2401)
E/AndroidRuntime( 693): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2417)
E/AndroidRuntime( 693): at android.app.ActivityThread.access
$2100(ActivityThread.java:116)
E/AndroidRuntime( 693): at android.app.ActivityThread
$H.handleMessage(ActivityThread.java:1794)
E/AndroidRuntime( 693): at
android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 693): at android.os.Looper.loop(Looper.java:
123)
E/AndroidRuntime( 693): at
android.app.ActivityThread.main(ActivityThread.java:4203)
E/AndroidRuntime( 693): at
java.lang.reflect.Method.invokeNative(NativeMethod)
E/AndroidRuntime( 693): at
java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 693): at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:791)
E/AndroidRuntime( 693): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
E/AndroidRuntime( 693): at
dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 693): Caused by: java.lang.SecurityException:
Requires ACCESS_FINE_LOCATION permission
E/AndroidRuntime( 693): at
android.os.Parcel.readException(Parcel.java:1218)
E/AndroidRuntime( 693): at
android.os.Parcel.readException(Parcel.java:1206)
E/AndroidRuntime( 693): at android.location.ILocationManager
$Stub$Proxy.getProviderInfo(ILocationManager.java:735)
E/AndroidRuntime( 693): at
android.location.LocationManager.getProvider(LocationManager.java:283)
E/AndroidRuntime( 693): at
com.geekdroid.BlogSend.onCreate(BlogSend.java:44)
E/AndroidRuntime( 693): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1123)
E/AndroidRuntime( 693): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2364)
E/AndroidRuntime( 796): ... 11 more
I/Process ( 53): Sending signal. PID: 796 SIG: 3
I/dalvikvm( 796): threadid=7: reacting to signal 3
I/dalvikvm( 796): Wrote stack trace to '/data/anr/traces.txt'
I have set the GPS coordinates in DDMS Location Controls, also set
coordinates using telnet and geo fix.
My manifest file has all permissions, dont know why im getting errors
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.geekdroid"
android:versionCode="1"
android:versionName="1.0">
<uses-permission
android:name="android.Manifest.permission.ACCESS_FINE_LOCATION"/>
<uses-permission
android:name="android.Manifest.permission.ACCESS_LOCATION"/>
<uses-permission
android:name="android.Manifest.permission.ACCESS_GPS"/>
<uses-permission
android:name="android.Manifest.permission.ACCESS_COARSE_LOCATION"/>
<application android:icon="@drawable/icon" android:label="@string/
app_name">
.....
.....
</application>
I would really appreciate 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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en