So far I've filled out the MTA online registration form for a Developer's API Key. Then in my android project, I implemented the gtfs realtime bindings dependecy from one of Google's github repositories,
compile group: 'com.google.transit', name: 'gtfs-realtime-bindings', version: '0.0.4'
Using their Java class, I tried this following code to print out all the gtfs data from the link given by MTA,
try {
String urlString = "http://datamine.mta.info/mta_esi.php?key=insertmykeyhere";
URL url = new URL(urlString.toString());
GtfsRealtime.FeedMessage feed = GtfsRealtime.FeedMessage.parseFrom(url.openStream());
for (GtfsRealtime.FeedEntity entity : feed.getEntityList()) {
if (entity.hasTripUpdate()) {
Log.d("stuff", entity.getTripUpdate().toString());
}
}
} catch (IOException e) {
e.printStackTrace();
}
However, I'm now having trouble interpreting the data printed out. I understand that there are static data feeds from http://web.mta.info/developers/developer-data-terms.html, which I used to interpret some of the data. Here is one of the trip updates printed out,
stuff: trip {
trip_id: "036000_GS.N01R"
start_date: "20170218"
route_id: "GS"
1001: "\n\0200S 0600 GCS/TSS\020\001\030\001"
}
stop_time_update {
departure {
time: 1487415600
}
stop_id: "901N"
1001: "\n\0011\022\0011"
}
stop_time_update {
arrival {
time: 1487415690
}
stop_id: "902N"
1001: "\n\0011"
}
I understand some parts such as trip_id, start_date, and stop_id. But parts such as trip_id, time, and 1001 I'm still unsure about it and the text files from the static feed don't do the best job of explaining them.