Reputation: 209
I am currently unable to display a location layer in my embedded GoogleMap within a Flutter application using the google_maps_flutter package. I have declared the required permissions in both the AndroidManifest.xml and Info.plist files and am setting the map's myLocationEnabled property to true. The resulting map displays neither the current location icon nor the "my location" button.
Questions such as this seem to suggest that another dependency may be required in order to display the Google Map location layer. However, I do not believe this is the case.
Am I missing something in my current approach or do I require an additional dependency?
I have included the following in my AndroidManifest.xml:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
And the following in my Info.plist:
<key>io.flutter.embedded_views_preview</key>
<true/>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Application needs to access your current location</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Application needs to access your current location</string>
Map code:
return GoogleMap(
mapType: MapType.normal,
initialCameraPosition: _lakeGenevaPos,
markers: _markers,
polylines: _polylines,
myLocationEnabled: true,
onMapCreated: (GoogleMapController controller) => _onMapCreated(controller),
);
pubspec.yaml dependency:
google_maps_flutter: ^0.5.13
Upvotes: 1
Views: 3132
Reputation: 6876
You should believe in that scenario :)
In IOS it should work. In Android check my answer also:
Geolocator Plugin to get current location
Upvotes: 4