dpa99c / phonegap-launch-navigator

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

Baidu Maps support #165

Closed rdantonio closed 6 years ago

rdantonio commented 6 years ago

Adding support for Baidu Maps would be great. The documentation is a bit tough to decipher without knowing Chinese but it's available here:

http://lbsyun.baidu.com/index.php?title=uri/api/ios http://lbsyun.baidu.com/index.php?title=uri/api/android

The core URL is baidumap://map/direction for both platforms for directions. I'd be happy to provide more info if needed. Thanks!

dpa99c commented 6 years ago

The documentation is a bit tough to decipher without knowing Chinese but it's available here

Google Translate does a pretty good job and the documentation itself is pretty good. I'll have a go at this soon.

dpa99c commented 6 years ago

Baidu Maps support is now implemented for iOS and Android and published in v4.1.0.

I've updated the Advanced Example app in the example project to add a couple of locations in Chinese for testing (since Baidu Maps doesn't recognise English right now).

dpa99c commented 6 years ago

Note: There appears to be a bug in the iOS version of Baidu Maps. If anyone can speak Chinese and knows how to report this to Baidu Maps as a bug, please help me out here:

Specifying both start/destination location as a coordinate and a nickname for the place doesn't seem to work on the iOS version of Baidu Maps, even though it's documented as being supported in the iOS URL scheme.

When the destination and/or start is specified as a lat/lon coordinate and startName and/or destName is specified, the Baidu Maps iOS app fails to launch.

Calling this on iOS doesn't launch the app, but it does on Android:

Called navigate() with args: destination=39.98871,116.43234; destType=coords; destName=Some place; start=39.940488,116.355425; startType=coords; startName=My place; appName=baidu; transportMode=driving; extras=<null>
Launching URI: baidumap://map/direction?destination=name:Some%20place|latlng:39.988710,116.432340&origin=name:My%20place|latlng:39.940488,116.355425&mode=driving&coord_type=wgs84

I thought maybe the Latin character set in the place names may be a problem, so I tried Chinese, but same result on iOS:

Called navigate() with args: destination=39.98871,116.43234; destType=coords; destName=对外经贸大学; start=39.940488,116.355425; startType=coords; startName=维莎水果工坊; appName=baidu; transportMode=driving; extras=<null>
Launching URI: baidumap://map/direction?destination=name:%E5%AF%B9%E5%A4%96%E7%BB%8F%E8%B4%B8%E5%A4%A7%E5%AD%A6|latlng:39.988710,116.432340&origin=name:%E7%BB%B4%E8%8E%8E%E6%B0%B4%E6%9E%9C%E5%B7%A5%E5%9D%8A|latlng:39.940488,116.355425&mode=driving&coord_type=wgs84

However, it works fine on iOS if only the address/placename is specified

Called navigate() with args: destination=对外经贸大学; destType=name; destName=对外经贸大学; start=维莎水果工坊; startType=name; startName=维莎水果工坊; appName=baidu; transportMode=driving; extras=<null>
Launching URI: baidumap://map/direction?destination=%E5%AF%B9%E5%A4%96%E7%BB%8F%E8%B4%B8%E5%A4%A7%E5%AD%A6&origin=%E7%BB%B4%E8%8E%8E%E6%B0%B4%E6%9E%9C%E5%B7%A5%E5%9D%8A&mode=driving&coord_type=wgs84

OR only the lat/lon is specified:

Called navigate() with args: destination=39.98871,116.43234; destType=coords; destName=; start=39.940488,116.355425; startType=coords; startName=; appName=baidu; transportMode=driving; extras=<null>
Launching URI: baidumap://map/direction?destination=39.988710,116.432340&origin=39.940488,116.355425&mode=driving&coord_type=wgs84

The expected result on iOS is that it successfully launches the app (which it doesn't) and uses the lat/lon for calculating the navigation route and the names for display purposes, which works fine on Android:

rdantonio commented 6 years ago

Great news, thank you for the effort! Our users are currently only using Android but I'll work with one of my team members who speaks Chinese to see if we can get this issue submitted to Baidu. Thanks again!

deepti1111111 commented 5 years ago

Hi, I am tying route using Baidu map with angularJS. but it creates markers instead of route navigation. please help me out

dpa99c commented 5 years ago

@deepti1111111 This plugin uses the official URL scheme of Baidu for directions navigation: baidumap://map/direction

How Baidu Maps then handles that URL scheme is entirely determined by Baidu - this plugin has no control over the inner workings of Baidu Maps.

deepti1111111 commented 5 years ago

Hey Dave Alden, Thanks for your response. I am trying to intergrate Baidu map on web. I want to show route navigation on web using angularJs as my project based. I am looking for the support. please let me know where I can get libraries those could support. or example where I am able take as reference. Thank you.