An Android app to check Hong Kong bus routes and estimated time of arrival (ETA) at each stop, using data from Kowloon Motor Bus Company (1933) Limited (KMB) (incorporating Long Win Bus Company Limited (LWB)), Citybus Limited (CTB) and New World First Bus Services Limited (NWFB) under the OpenAPI initiative of the Hong Kong Government.
- Clone the repository into a local directory.
- Open the project directory in Android Studio.
In MainActivity, to look up the routes in each company.
In MainActivity, to determine whether the route is circular (no inbound stops).
In SelectStopActivity, to get all stop IDs of the selected route.
In SelectStopActivity, to get the stop name, location (latitude and longitude).
In SelectTimeActivity, to get the ETA of selected stop.
The app consists of 3 Activities, namely:
- MainActivity
- SelectStopActivity
- SelectTimeActivity
The initial screen, allowing users to input route number in EditText. After input, all companies with a route with such number are displayed. Click on a company to show all stops on their route.
These are same route operated by one of KMB/LWB & one of CTB/NWFB. The companies operating the route will be displayed as below. (Note that LWB routes are displayed as KMB since no separate API to differentiate.)
These are routes that have only 1 terminus, directly returning back to its origin after reaching its outbound destination. Only outbound destination is shown.
Alternatively, if no such route is found in any company, an error message is displayed.
The screen displays all normal operation bus stops on the route (Note: stops which are served only during diversion are not shown for KMB routes). Click on any stop to view the ETA.
Note: for jointly-operated routes, the stop names of KMB are used by default.
This screen displays the first ETA of the selected route, direction and stop. It displays in both time (UTC+8) and countdown in minutes.
Notes:
Both companies' API are called, and stops are matched by latitude and longitude not exceeding 2e-3 degree of each other. (Note: the outbound/inbound directions of cross harbour routes is opposite between KMB and CTB/NWFB but same for non-cross harbour routes.) The earliest ETA is shown on screen. The company TextView will only show the operator of that departure. The destination and stop name will be displayed according to the operator's names.
For example, below N619 (jointly-operated by CTB/KMB) departure at 02:37 is operated by CTB.
The ETA API returns departures within an hour. If no ETA is returned, below error message is displayed. It may be due to out of service hours of route or data error. Use the Refresh button to refresh the status.
- Allow app to send notification of ETA of certain route at specified time.