Reputation: 692
Inside my app I am supplied with a shipment address. And when the user presses a button it launches an intent to google maps with that address as a parameter.
String uri = String.format(Locale.ENGLISH, "google.navigation:q=" + shipmentAdress);
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse(uri));
startActivity(intent);
I would like to do the same thing for our customers in China that do not have access to Google Maps but to Baidu Maps. Keep in mind that I don't have GPS coords, just the address.
Does anyone know how I would go about doing that? All their documentation is in Chinese and so is their app, and I've only gotten so far with Google Translate.
I've got it down to something like "baidumap://map/geocoder?src=openApiDemo&address="
but it usually returns and error (I think, I used screenshots of the error and Pleco's OCR to sort of translate it.)
Upvotes: 2
Views: 700
Reputation: 435
Try to use this Intent
try {
Intent intent = Intent.parseUri("intent://map/marker?location=21.028399,105.790824&title=CV Cầu &content=Công viên vui chơi&src=yourCompanyName|yourAppName#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end", Intent.URI_INTENT_SCHEME);
if (intent.resolveActivity(getActivity().getPackageManager()) != null) {
startActivity(intent);
}
} catch (URISyntaxException e) {
e.printStackTrace();
}
Upvotes: 0
Reputation: 692
Figured it out eventually:
String uri = String.format(Locale.CHINA, "baidumap://map/navi?query=" + shipmentAdress);
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse(uri));
startActivity(intent);
Upvotes: 1