Map is always loading when controller is initialized with initMapWithUserPosition as true
Hi, When the controller is initialized with initMapWithUserPosition as true, the map keeps loading
final MapController _mapController = MapController(
initMapWithUserPosition: true,
);
Steps to reproduce on the latest flutter_osm_plugin: ^0.30.1+2
on the example app, change controller initialization initMapWithUserPosition to true.
Tested on Samsung A10s (Android 11) and iPhone SE (iOS 14.7.1), Although it worked on the Android Emulator on the second launch, the first launch gave these errors while the permission dialog popped up
[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(PermissionHandler.PermissionManager, A request for permissions is already running, please wait for it to finish before doing another request (note that you can request multiple permissions at the same time)., null, null)
E/flutter (32151): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
E/flutter (32151): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:167:18)
E/flutter (32151):
Many thanks for creating this wonderful package, Please do let me know if you want me to share any further info/logs.
i will check that and i will fix it
you face the same problem in iOS ?
yes, I faced the same problem in iOS
in iOS doesn't show you popup for permission ? or it shows and even if you grant the permission the map doesn't show because for android , yes i confirm that their is a problem and already fixed i will make commit and it will available with new release 0.31.0
I had it just verified, iOS didn't show the permission popup
for iOS, did you check that location is on ?
yes, location services enabled
On Fri, Feb 18, 2022, 10:25 PM hamza mohamed ali @.***> wrote:
for iOS, did you check that location is on ?
— Reply to this email directly, view it on GitHub https://github.com/liodali/osm_flutter/issues/232#issuecomment-1044832441, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIX7KHL3L35DPWQP3BCLADDU3Z2XJANCNFSM5OXNSJOQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you authored the thread.Message ID: @.***>
for iOS, did you add those lines in info.plist ?
<key>NSLocationWhenInUseUsageDescription</key>
<string>any text you want</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>any text you want</string>
iOS permission was already granted, my bad restarted iPhone and the map worked on the iPhone
I got it working on Android, Now I can be more precise on reproducing this bug on Android.
There's this Google's FusedLocationProviderClient that I've used in a different native app. When you try to get the lastLocation sometimes it doesn't return any result due to various reasons such as no lastLocation available or turning off/on the GPS clears cache etc.
So, I opened the google maps so it would cache the lastLocation and then opened the sample app, then the maps loaded, otherwise it kept loading
for android like i told you i fix that bug, i will publish new version this weekend that contain this fix and other feature
Thank you for the quick fix.
check the new version 0.31.0
Thank you very much, this bug has been resolved. I'll close this issue