Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/192.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 通过提供GPS坐标,将Google导航启动到特定位置_Android_Navigationcontroller - Fatal编程技术网

Android 通过提供GPS坐标,将Google导航启动到特定位置

Android 通过提供GPS坐标,将Google导航启动到特定位置,android,navigationcontroller,Android,Navigationcontroller,我想知道是否可以通过从应用程序中提供特定位置的GPS坐标来启动Google导航到该位置。如果您的意思是要通过提供纬度和经度坐标从应用程序中启动Google逐圈导航,那么下面是代码: public void launchNavigation(){ String location = mLat + "," + mLng; Uri gmmIntentUri = Uri.parse("google.navigation:q="+location); Intent mapInten

我想知道是否可以通过从应用程序中提供特定位置的GPS坐标来启动Google导航到该位置。

如果您的意思是要通过提供纬度和经度坐标从应用程序中启动Google逐圈导航,那么下面是代码:

public void launchNavigation(){
    String location = mLat + "," + mLng;
    Uri gmmIntentUri = Uri.parse("google.navigation:q="+location);
    Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
    mapIntent.setPackage("com.google.android.apps.maps");
    startActivity(mapIntent);
}
基本上,在Uri参数中,您可以传递street address或Lat,Lng,如下所示:

google.navigation:q=a+street+address
google.navigation:q=latitude,longitude
我希望这能帮助有同样问题的人,因为我想你的问题早就解决了