Uri投掷Uber意图

时间:2017-04-26 16:23:27

标签: android android-intent geolocation uri

我正在开发一个基于地理定位的应用程序,我有一个选项:“显示我的方式”应该显示地图以及如何到达那里,到目前为止正在使用谷歌地图,以及与优步的Waze应用程序正在应用程序选择器中显示我正在从应用程序中抛出的操作(意图),但它不能用于接收数据,那么我应该发送哪些其他数据?我正在阅读Uber官方文档,但它更适用于基于Web和URL的调用,我还没有找到一个带有“geo”标签的示例我正在使用并且适用于其他应用程序。

我用来抛出Intent的代码是:

case R.id.menu_ride:
    {
      String uri = "geo: "+newPlace.getLatitude()+","+newPlace.getLongitude();
      startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)));
      return  true;
    }

1 个答案:

答案 0 :(得分:0)

我不知道这是否是正确的方法,但这是我使用它的方式,它在谷歌地图,优步和Waze上工作没有问题:

case R.id.menu_ride:
    {
      String uri = "geo: "+newPlace.getLatitude()+","+newPlace.getLongitude() +
                   "?q="+newPlace.getLatitude()+","+newPlace.getLongitude()  ;
          startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)));
          return  true;
    }

看起来像你必须添加GET参数" q"用于查询。