dpa99c / phonegap-launch-navigator

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

Doesn't work with CityMapper #180

Closed eg271 closed 6 years ago

eg271 commented 6 years ago

Following works fine with GMaps and Apple Maps but doesn't load the start or destination fields after opening the CityMapper app:

launchnavigator.navigate("Westminster", {app: launchnavigator.APP.CITYMAPPER, start:"Shoreditch"})

Tested v 4.1.3 on iOS 11.2.1

dpa99c commented 6 years ago

Thanks for reporting this. I've tested with the latest version of Citymapper on iOS (v6.26.2) and can confirm that the plugin no longer successfully launches it with the start/destination fields populated.

Support for Citymapper on iOS was added in March 2016 and tested against v5.15, at which point the generated URL from this plugin worked correctly, so it's possible their URL scheme has changed.

The plugin appears to generate the correct iOS custom URL scheme as documented by Citymapper, for example:

citymapper://directions?startaddress=Westminster&endaddress=Shoreditch

Look at their documentation, it seems they're moving away from the custom URL scheme citymapper:// to the Universal Links-style URL https://citymapper.com/, so it's possible they've dropped support for the former or at least it's only supported on older versions of iOS.

I will give this a test later when I have some time.

dpa99c commented 6 years ago

I've tried using the Universal Links-style URL (https://citymapper.com/) to open Citymapper. Although the app gets launched, it proceeds to open the URL in its internal InAppBrowser, rather than parsing the URL to extract the locations - see this screen capture which demonstrates this.

I also tried using lat/lon coords in case it was just a problem with addresses, but this also fails:

citymapper://directions?startcoord=51.501564,-0.141879&endcoord=51.498739,-0.133827

So currently, I don't have a working solution for Citymapper on iOS. I still need to regression test on Android to check if that still works.

I'm unsure whether there's a new version of the URL scheme which is documented somewhere else, or whether this is a bug in the latest version of Citymapper: I'll try to contact someone at Citymapper to get some info on this.

dpa99c commented 6 years ago

Just tested both custom URL scheme and Universal Links scheme with Android, and while both launch the app, the input locations are not used to populate the start and destination fields (same as for iOS).

dpa99c commented 6 years ago

Regression testing with the latest versions of Citymapper (Android v7.30.0 and iOS v6.26.2) has shown that while Citymapper on both Android and iOS still doesn't support native input of location as an address (passing in an address without accompanying coordinates caused Citymapper to fail to populate the location fields), passing in location as a coordinate pair works on both the latest Android & iOS versions of Citymapper.

Therefore I will update the plugin to attempt to geocode any input address to a lat/lon coordinate pair to be passed to Citymapper.