How to open navigation instead of mapview in andro

2019-06-27 05:04发布

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:

1st screenshot

2nd screenshot here

3rd screenshot

1条回答
Root(大扎)
2楼-- · 2019-06-27 05:47

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));
查看更多
登录 后发表回答