How to open navigation instead of mapview in android?

时光总嘲笑我的痴心妄想 提交于 2020-01-03 18:50:07

问题


I have plotted location and if it has been clicked, it goes to maps and from maps, if it has been clicked direction, it opens google navigation.Is it possible to directly link with navigation?

I have defined the code like this.

GeoPoint pt = item.getPoint();

String lat = Double.toString(pt.getLatitudeE6() / 1e6);

String lng = Double.toString(pt.getLongitudeE6() / 1e6);

intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("geo:0,0?q=" + lat + "," + lng));

In uri, what should be given to open navigation? I want to skip 2nd screenshot and directly

open navigation. how to do this?

My Screenshot are as follows:


回答1:


However I found a solution

Intent intent;
GeoPoint pt = item.getPoint();
String lat = Double.toString(pt.getLatitudeE6() / 1e6);
String lng = Double.toString(pt.getLongitudeE6() / 1e6);               
intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("google.navigation:q=" + lat + "," + lng));


来源:https://stackoverflow.com/questions/15426611/how-to-open-navigation-instead-of-mapview-in-android

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