【问题标题】:launch the Google navigation to a specific location by providing GPS coordinates通过提供 GPS 坐标启动 Google 导航到特定位置
【发布时间】:2011-06-29 08:52:20
【问题描述】:

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

【问题讨论】:

    标签: android navigationcontroller


    【解决方案1】:

    如果您的意思是要通过提供纬度和经度坐标从您的应用程序中启动 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 参数中,您可以传递街道地址或 Lat,Lng,如下所示:

    google.navigation:q=a+street+address
    google.navigation:q=latitude,longitude
    

    我希望这可以帮助遇到同样问题的人,因为我猜你的问题早就解决了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-16
      • 1970-01-01
      • 2012-12-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多