Skip to content

A android library for accessing the Auckland Transport public api

Notifications You must be signed in to change notification settings

josh-burton/AtApiWrapper

Repository files navigation

#AtApiWrapper

##About

The AtApiWrapper is a android library that is a wrapper around the Auckland Transport public api.

Retrofit is used under the hood to perform all requests, which in turn uses OkHttp.

I reccommend having a read through the Retrofit docs.

##Available endpoints

  • Realtime
  • GTFS
  • Display (Parking Locations, Scheduled Works)

##How to use

You must first have an api key. You can get one from here.

Synchronously

//construct api object with our api key
AtApi api = new AtApi(apiKey);

//get the 	realtime service
RealtimeService realtimeService = api.getRealtimeService(); 

//get vehicle locations synchronously
return realtimeService.vehiclelocations();

Asynchronously

//construct api object with our api key
AtApi api = new AtApi(apiKey);

//get the 	realtime service
RealtimeService realtimeService = api.getRealtimeService(); 

//get vehicle locations asynchronously, by passing in an retrofit Callback object
realtimeService.vehiclelocations(callback);

###Running the sample app

The sample app is simple a practical example of how to query the api. It would be better just to look through the code, but if you do want to run the app, you will need to add your api key to the VehicleLocationListFragment.

###How to include in your project

###1. As a jar Get the jar from the downloads page

About

A android library for accessing the Auckland Transport public api

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages