I’ve been using the Google Maps Plugin for many years now in Cordova projects. It provides access to native Google maps, which imho gives a better user experience than using the JavaScript api.
Sadly the plugin doesn’t get updated anymore, even though I bought the developer a virtual beer a while ago. After having read this discussion I first tried using the fork at https://github.com/we-are-joinup/cordova-plugin-googlemaps/ :
- Create the project and cd into the project directory
- run
cordova plugin add https://github.com/we-are-joinup/cordova-plugin-googlemaps/
- run
cordova platform add android@11.0.0
- in platforms/android/cordova-plugin-googlemaps/***-tbxml-android.gradle : in the
dependencies
{} replacecompile
byimplementation
Building and running the app went fine, the map opened nicely, custom markers showed up after setting the right path. But getMyLocation
would always fail, making this road a dead end. Back to the original plugin.
Here’s how I got 2.7.1 going, with an additional plugin and some Java code patches:
- Create the project and cd into the project directory (or, when already present, remove the maps plugin and the Android platform)
- run
cordova plugin add cordova-plugin-androidx-adapter
- run
cordova plugin add cordova-plugin-google-maps
- Apply all patches mentioned here
- run
cordova platform add android@11.0.0
Building and running the app went fine, and this time getMyLocation
would actually work.