4
votes

I want to use Google Transit API in Android application. But I am getting data from service. I used the following parameters:

http://maps.googleapis.com/maps/api/directions/json?origin=Brooklyn&destination=Queens&sensor=false&departure_time=1343605500&mode=transit

I always get this response:

{
   "routes" : [],
   "status" : "ZERO_RESULTS"
}

I think I am passing something wrong in any of parameters used in above URL, maybe departure_time is wrong?

Can anyone tell what should pass to parameters?
Can anyone help me to find out URL with such parameters which return value ?

1

1 Answers

3
votes

You just have to set departure_time parameter to some time in future (like several days). From here:

When requesting transit directions, be sure to specify either a departure_time or arrival_time. Note that in this example the departure time is specified as July 30, 2012 at 09:45 am. Update the parameter to a point in the future before submitting the request.

Try http://maps.googleapis.com/maps/api/directions/json?origin=Brooklyn&destination=Queens&sensor=false&departure_time=1350472557&mode=transit, it works.