Question

I am having issues with passing a longitude and latitude to the google directions api (http://code.google.com/apis/maps/documentation/directions/) can anyone tell me what i am doing wrong, i am always getting no results but if i use address its fine

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

Thanks

Was it helpful?

Solution 2

I solved the problem by putting the parameters in the correct order, latitude should come before longitude

OTHER TIPS

Use this Code

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);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top