我想在启用我的位置图层的谷歌地图上显示用户的位置,但此功能需要“ ACCESS_FINE_LOCATION ”权限才能从 GPS 获取位置。是否可以阻止GoogleMap尝试从 GPS 获取位置?
如果我删除 Manifest 文件中的“ ACCESS_FINE_LOCATION ”权限,一旦我尝试显示地图,应用程序就会崩溃并出现以下错误:
E/AndroidRuntime(28578): FATAL EXCEPTION: main
E/AndroidRuntime(28578): java.lang.SecurityException: Client must have ACCESS_FINE_LOCATION permission to request PRIORITY_HIGH_ACCURACY locations.
E/AndroidRuntime(28578): at android.os.Parcel.readException(Parcel.java:1425)
E/AndroidRuntime(28578): at android.os.Parcel.readException(Parcel.java:1379)
E/AndroidRuntime(28578): at bbj.a(SourceFile:424)
E/AndroidRuntime(28578): at bbn.a(SourceFile:232)
E/AndroidRuntime(28578): at maps.al.b.j(Unknown Source)
E/AndroidRuntime(28578): at uh.h(SourceFile:642)
E/AndroidRuntime(28578): at un.a(SourceFile:399)
E/AndroidRuntime(28578): at uj.a(SourceFile:158)
E/AndroidRuntime(28578): at ui.handleMessage(SourceFile:111)
E/AndroidRuntime(28578): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(28578): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(28578): at android.app.ActivityThread.main(ActivityThread.java:5041)
E/AndroidRuntime(28578): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(28578): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(28578): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime(28578): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime(28578): at dalvik.system.NativeStart.main(Native Method)