I am upgrading our app to Ionic5 and Google Maps is a key component.
In Ionic5 manner I tried to stick with Capacitor as it it recommended. However,
running Google Maps in the labs / simulator I get in the browser console:
[GoogleMaps]You need to execute "$> ionic cordova run browser"."$> ionic serve" is not supported.
Dependency as in the package.json
"@ionic-native/google-maps": "^5.0.0-beta.27",
It suggests to fall back to cordova. I thought capacitor was the future and I should stay away from Cordova? Or is a hybrid cordova & capacitor mode possible? If so, how?
Thanks! Is this an official package that is used over various projects? First time I see this implementation.
I’m curious since this is not linked against in the official ionic docs.
I’m set on building a robust update and careful to not add not 100% supported packages.
It is part of @angular/components which is not a default angular package, but it is the official repo for
the Material Design package if I’m not mistaken
I think the Google maps docs has instructions on how to acquire an API key through the cloud console
I typically add the API key to the environments files and access it from there, and then in the root file of the app (src/index.html), add the script as per the Google maps docs documentation. It also appears you can add it dynamically but I have not tried it that way.
Then the Google maps package should be able to implemented following the readme
I am using google maps on ionic 5 but what i did was used Google maps javascript api and it worked. I used capacitor for geolocation tho and it comes together nicely
@ionic-native/google-maps and cordova-plugin-googlemaps work on Capacitor Android, however they do not work on Capacitor iOS, due to the technical problem of Capacitor iOS.
In order to work on iOS, I have to work for the plugin lots of time.
Please support the fundraising.
But how to restrict javascript map to android application.
We can restrict API key from the website but it can not be restricted from native android application