如何解决此“由于未授予位置权限而无法启用MyLocation层"? [英] How to resolve this "Cannot enable MyLocation layer as location permissions are not granted"?

查看:122
本文介绍了如何解决此“由于未授予位置权限而无法启用MyLocation层"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在颤振页面中包含了一个简单的GoogleMap组件,只是为了查看它是否有效,但我无法解决此问题.我编译了应用程序,当我导航到该页面时,在控制台中出现以下错误:

I have included in my flutter page a simple GoogleMap component only to see if it works but I can't resolve this problem. I compile the application and when I navigate to the page I get the following error in the console:

"E/GoogleMapController(3376):由于未授予位置权限,因此无法启用MyLocation图层"

"E/GoogleMapController( 3376): Cannot enable MyLocation layer as location permissions are not granted"

我可以看到该组件,但看不到地图(请参见图片):

I can see the component but I'm not able to see the map (see the image):

添加的配置:

//(AndroidManifest.xml)

<meta-data android:name="com.google.android.geo.API_KEY" android:value="apikey"/>

//(pubspec.yaml)
google_maps_flutter: ^0.5.0

编辑-解决方案

添加权限包以请求权限.您可以安装此软件包来管理权限: https://pub.dartlang.org/packages/permission

Add the permission package to request permission. You can install this package to manage your permissions: https://pub.dartlang.org/packages/permission

推荐答案

android.permission.ACCESS_FINE_LOCATION 被视为危险许可.您是否使用过 permission 包来请求许可? https://pub.dartlang.org/packages/permission

android.permission.ACCESS_FINE_LOCATION is considered a dangerous permission. Have you used the permission package to request the permission? https://pub.dartlang.org/packages/permission

这篇关于如何解决此“由于未授予位置权限而无法启用MyLocation层"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆