Launching Google Maps Directions via an intent on Android

后端 未结 15 1545
小鲜肉
小鲜肉 2020-11-22 03:46

My app needs to show Google Maps directions from A to B, but I don\'t want to put the Google Maps into my application - instead, I want to launch it using an Intent. Is this

15条回答
  •  星月不相逢
    2020-11-22 04:17

    try this

    Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?saddr="+src_lat+","+src_ltg+"&daddr="+des_lat+","+des_ltg));
    intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
    startActivity(intent);
    

提交回复
热议问题