dpa99c / phonegap-launch-navigator

Phonegap/Cordova plugin which launches native route navigation apps for Android, iOS and Windows
369 stars 131 forks source link

Unable to open Here WeGo map in Android using LaunchNavigator #211

Closed dhruvsingh50 closed 5 years ago

dhruvsingh50 commented 5 years ago

I'm having problem with opening Here Map in Android ( It is working fine for iOS ).

Ionic -v : 3.20.0
node -v : 6.9.1
npm -v  : 5.6.0
cordova -v : 8.0.0`
launchNavigatorPopup(myAddress) {
this.launchNavigator.navigate(myAddress,
      {
        appSelection: {
          list: [
            this.launchNavigator.APP.GOOGLE_MAPS,
            this.launchNavigator.APP.HERE_MAPS
          ]
        }
      })
}

Note: myAddress is string type.

On clicking Here Maps nothing is happening. This code is working fine with Google maps (both iOS and Android) but with Here maps, it is working in iOS devices but in Android, on clicking nothing is happening.

dpa99c commented 5 years ago

I've had a look at this and the problem is not specific to HERE Maps - it affects all navigation apps on Android which require geocoding of an address to a lat/lon coordinate.

When you pass an address to this plugin, it checks to see if the target navigation app supports an address as an input type. In the case of Google Maps, it will accept either an address or a lat/lon coordinate pair as input. But in the case of HERE Maps, it only accepts a lat/lon coordinate pair, so this plugin attempts to geocode the address that you passed in to a coordinate pair which can be passed to Here Maps.

The plugin uses Google's Geocoding API to do this and this has always worked fine. However, as stated in this SO post, Google now requires that you provide an API key in order to use their Geocoding API. And because this plugin currently does not support passing an API key, the Geocoder API responds with an error:

{
   "error_message" : "You must use an API key to authenticate each request to Google Maps Platform APIs. For additional information, please refer to http://g.co/dev/maps-no-account",
   "results" : [],
   "status" : "REQUEST_DENIED"
}

I will need to modify the plugin to enable a Google API key to be passed through to the Geocoder API request.

dpa99c commented 5 years ago

This issue should be resolved by v5.0.0 of the plugin which has now been published to npm. It enables you to specify the Google API key for Android on plugin install.

This is a major version change so please report any issues you encounter.