小编Cur*_*rly的帖子

Flutter Google Maps 无法确定设备的当前位置

我正在使用 Flutter 的 Geolocator 和 Google Maps 包来确定设备的位置。我利用循环进度条等待确定当前位置。确定后,Google 地图会加载识别出的设备位置。

应用程序加载时,显示圆形进度条,但显示通知并接受使用位置服务,但未加载地图;该应用程序挂在圆形进度条上。我不相信这是一个 API 问题,因为我已经成功地使用 InitialCameraPosition 中指定的坐标加载了地图。

是否未确定设备的位置,这是导致地图无法加载所指示位置的原因?

我尝试在 Android 模拟器和物理设备上运行该应用程序,但没有成功。

Android Manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="smartkart.app.com.coffee">

<!-- io.flutter.app.FlutterApplication is an android.app.Application 
 that
     calls FlutterMain.startInitialization(this); in its onCreate 
  method.
     In most cases you can leave this as-is, but you if you want to   
      provide
     additional functionality it is fine to subclass or reimplement
     FlutterApplication and put your custom class here. -->

 <uses-permission  
 android:name="android.permission.ACCESS_FINE_LOCATION" />



<application
    android:name="io.flutter.app.FlutterApplication"
    android:label="coffee"
    android:icon="@mipmap/ic_launcher">
    <meta-data android:name="com.google.android.geo.API_KEY"
               android:value="API KEY HERE"/>
    <activity../> …
Run Code Online (Sandbox Code Playgroud)

google-maps flutter

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

flutter ×1

google-maps ×1