【问题标题】:Get my geolocation and create intent to show it获取我的地理位置并创建显示它的意图
【发布时间】:2015-03-13 09:12:58
【问题描述】:

我试图获取我所在位置的纬度和经度,但我找到了它。当我检查它时,我的纬度和经度是正确的。但是当我尝试用我的纬度和经度创建谷歌地图意图时。地图显示错误的位置。

这是我的意图

        Builder gmmIntentUri = Uri.parse(mess)
                .buildUpon()
                .appendQueryParameter("q", label)
                .appendQueryParameter("z", "16");
        Intent intent = new Intent(android.content.Intent.ACTION_VIEW, gmmIntentUri.build());
        startActivity(intent);

我一直在尝试使用其他选项

        String label = "He/She were here!";
        String latitude = gps.getLatitude();
        String longitude = gps.getLongitude();
        String query = latitude + "," + longitude + "(" + label + ")";
        String encodedQuery = Uri.encode(query);
        String uriString = mess + "?q=" + encodedQuery + "&z=16";
        Uri uri = Uri.parse(uriString);
        Intent intent = new Intent(android.content.Intent.ACTION_VIEW, uri );
        startActivity(intent);

但他们都显示错误的地方。如何解决?

【问题讨论】:

    标签: android google-maps android-intent geolocation maps


    【解决方案1】:

    试试这个

     Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("geo:<lat>,<long>?q=<lat>,<long>(Label+Name)"));
    
        startActivity(intent);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-22
      • 1970-01-01
      • 1970-01-01
      • 2013-12-02
      • 2015-05-13
      • 2016-01-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多