问题
When I open Google Maps using google map URL for the first time(if google map is not running in background) direction will not show. If google map is running in background then direction will show properly. I am working on Cordova, in android, this issue is not there but in iOS, I am getting this issue. My code is: I used all these URL but it's not working in iOS if Google Maps is not running in the background.
var mapLocationUrl = "https://maps.google.com/maps?saddr=current location&daddr=" + lat + "," long;
var mapLocationUrl = "https://www.google.com/maps/dir/?api=1&destination=" + lat + "," + long + "&travelmode=driving";
var mapLocationUrl = "maps://maps.google.com/maps?daddr=" + lat + "," + long + "&ll=";
var mapLocationUrl = "comgooglemaps://?saddr=&daddr=" + lat + "," + long;
var mapLocationUrl = "https://maps.google.com/maps?origin=My Location" + "&daddr=" + lat + "," + long;
var mapLocationUrl = "https://maps.google.com/maps?daddr=" + lat + "," + lng;
window.open(encodeURI(mapLocationUrl), '_self', 'location=yes');
window`.open(encodeURI(mapLocationUrl), '_system', 'location=yes');
回答1:
It looks like this may be related to the following issue reported in Google's Issue Tracker:
https://issuetracker.google.com/issues/142856429
I recommend you star the issue to get updates on it and increase visibility.
Hope this helps you.
来源:https://stackoverflow.com/questions/58445322/google-map-loading-issue-in-cordova-ios