Launching Huawei Petal Maps Directions via Intent on Android

≯℡__Kan透↙ 提交于 2021-01-28 04:15:57

问题


Is it possible to launch Huawei Petal Maps with navigation from point A to point B using intent just like in google maps? If yes, how?


回答1:


Yes, you can use an intent to launch the Petal Map app, and then use navigation functions in the app.

  • Deep link example:
mapapp://navigation?saddr=xxx&daddr=xxx&language=xx&type=xxx
mapapp://navigation?saddr=home&daddr=company&language=en&type=drive
mapapp://navigation?type=exit
  • To use this function, you need to set uriString to the following:
"mapapp://navigation?saddr=25.102916,55.165363&daddr=25.164610000000,55.228869000000&language=en&type=drive"
  • Sample code after modification:
String uriString = "mapapp://navigation?saddr=25.102916,55.165363&daddr=25.164610000000,55.228869000000&language=en&type=drive"; 
Uri content_url = Uri.parse(uriString); 
Intent intent = new Intent(Intent.ACTION_VIEW, content_url); 
if (intent.resolveActivity(getPackageManager()) != null) {
     startActivity(intent); 
}

For more details, see docs.



来源:https://stackoverflow.com/questions/65715494/launching-huawei-petal-maps-directions-via-intent-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!