我正在开发一个应用程序,该应用具有通过显示方向链接到" Google Map"的功能,它使用Google Map可以与设备一起使用。但是在某些设备中,使用" Google Map Go"one_answers" Google Map Go的导航",似乎这些应用程序与" Google Map"相同。
。我尝试替换" Google Map "软件包," Google Map Go Go Go "one_answers" for Google Map for Google Map go Go Go "软件包。但这不起作用。
Uri gmmIntentUri = Uri.parse("google.navigation:q=" + destinationPoint.latitude + "," + destinationPoint.longitude + "&mode=d");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.navlite");
context.startActivity(mapIntent);
我研究了,找不到任何文档,所以如何做?
String uri = String.format(Locale.ENGLISH, "geo:%f,%f?z=%d&q=%f,%f(%s)",
latitude, longitude, 16, latitude, longitude,
"Your Location TEXT");
//Try for google Maps 1st.
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
intent.setPackage("com.google.android.apps.maps");
try
{
(getContext()). startActivity(intent);
}
catch(ActivityNotFoundException ex)
{
try
{//Now try for GO MAPS / Browser
uri = "http://maps.google.com/maps?daddr=" + latitude + "," + longitude ;
Intent unrestrictedIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
(getContext()).startActivity(unrestrictedIntent);
}
catch(ActivityNotFoundException innerEx)
{//Finally show a toast.
Toast.makeText((v.getContext().getApplicationContext()),
"Install Google maps") , Toast.LENGTH_LONG).show();
}
}