Передача долготы и широты в API направления Google - PullRequest
2 голосов
/ 12 января 2012

У меня проблемы с передачей долготы и широты в API Google Directions (http://code.google.com/apis/maps/documentation/directions/) Может кто-нибудь сказать мне, что я делаю неправильно, я всегда получаю никаких результатов, но если я использую адрес, его штраф

JSONObject jsonLocation = JSONfunctions.getJSONfromURL("http://maps.googleapis.com/maps/api/directions/json?origin=" + currentLongitude + "," +  currentLatitude + "&destination=" + longitude + "," + longitude +"&sensor=true&region=gb");

Спасибо

Ответы [ 2 ]

4 голосов
/ 12 января 2012

Используйте этот код

Intent intent = new Intent(
                            android.content.Intent.ACTION_VIEW,
                            Uri.parse("http://maps.google.com/maps?saddr="+ latitude + "," + Longitude+ "&daddr="+latitudeDb+","+longitudeDb+""));
                    intent.setClassName("com.google.android.apps.maps",
                            "com.google.android.maps.MapsActivity");
                    startActivity(intent);
2 голосов
/ 13 января 2012

Я решил проблему, поставив параметры в правильном порядке, широта должна идти перед долготой

...