ionic-team / ionic-native-google-maps

Google maps plugin for Ionic Native
Other
221 stars 125 forks source link

setMyLocationEnabled(true) doesn't display the blue dot on Android, only on iOS #324

Closed danieltanasec closed 3 years ago

danieltanasec commented 3 years ago

I'm submitting a ... (check one with "x")

If you choose 'problem or bug report', please select OS: (check one with "x")

cordova information: (run $> cordova plugin list)

cordova-plugin-actionsheet 2.3.3 "ActionSheet"
cordova-plugin-background-fetch 5.6.1 "CDVBackgroundFetch"
cordova-plugin-background-mode 0.7.3 "BackgroundMode"
cordova-plugin-badge 0.8.8 "Badge"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-device-orientation 2.0.1 "Device Orientation"
cordova-plugin-dialogs 2.0.2 "Notification"
cordova-plugin-geolocation 4.0.2 "Geolocation"
cordova-plugin-globalization 1.11.0 "Globalization"
cordova-plugin-googlemaps 2.7.1 "cordova-plugin-googlemaps"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.1.3 "cordova-plugin-ionic-webview"
cordova-plugin-local-notification 0.9.0-beta.2 "LocalNotification"
cordova-plugin-nativegeocoder 3.2.2 "NativeGeocoder"
cordova-plugin-nativestorage 2.3.2 "NativeStorage"
cordova-plugin-pedometer 0.4.1 "Core Motion Pedometer"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-taptic-engine 2.1.0 "Taptic Engine"
cordova-plugin-vibration 3.1.1 "Vibration"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-sms-plugin 1.0.0 "Cordova SMS Plugin"
cordova.plugins.diagnostic 5.0.2 "Diagnostic"
uk.co.workingedge.phonegap.plugin.launchnavigator 5.0.4 "Launch Navigator"

If you use @ionic-native/google-maps, please tell the package.json (only @ionic-native/core and @ionic-native/google-maps are fine mostly)

"@ionic-native/core": "^5.27.0",
"@ionic-native/google-maps": "^5.5.0",

Current behavior: setMyLocationEnabled(true) doesn't display the blue dot on Android, only on iOS. Also setting myLocation to true while generating the map behaves the same.

let mapOptions: GoogleMapOptions = { camera: { target: myLocation.latLng, zoom: this.zoom, tilt: 30, }, styles: mapStyle, preferences: { zoom: {minZoom: 6, maxZoom: 20} }, controls: { myLocation: true } };

Screen capture or video record:

wf9a5m75 commented 3 years ago

Please share your project files on GitHub

danieltanasec commented 3 years ago

I cannot share the project unfortunately. It is a private app.

danieltanasec commented 3 years ago

I can prepare a test demo to see if it behaves the same

wf9a5m75 commented 3 years ago

I don't mind private or public repo.

danieltanasec commented 3 years ago

I have prepared a test demo at https://github.com/Tzuya14/test_ionic_gm_location_android. Still same issue.. The app requests location permission, the map is centered to my actual location, but no blue dot is displayed.

danieltanasec commented 3 years ago

I come back with an update. After I closed and opened the app multiple times I observed that once the blue dot appeared on the map, the next time I reopened the app it disappeared again.. Still this is strange.

wf9a5m75 commented 3 years ago

I tested your code. Your situation has been reproduced first couple of times when I tried with your API key. (But your API key is restricted, that's why I could not see the map)

I changed to my API key, then solved the situation. I don't know why. Even, after closing the app, launch it again, no problem at all.

Blue dot is displayed by Google Maps SDK for Android itself, not this plugin. That's why I can not do anything

danieltanasec commented 3 years ago

I understand. So it may be an API issue. I will look into it. Thanks a lot for your help.

danieltanasec commented 3 years ago

I observed in the console that I get the error E/PluginLocationService: ===> googleApiClient.isConnected() is not connected Could it be related in some way to this issue? I tried to renew the API with no restrictions, activated all MAPS related services, fixed all issues in Android manifest and still no luck..

wf9a5m75 commented 3 years ago

Maybe your Google Play Services is old?

danieltanasec commented 3 years ago

I use a Huawei mobile for testing :). Could that be the issue?

wf9a5m75 commented 3 years ago

Possible. Please try another Android phone which is not China maker brand.