Skip to content

An Android app to track CTA buses in real-time, providing bus routes, stops, and arrival predictions using the CTA Bus Tracker API.

Notifications You must be signed in to change notification settings

kartiknagar333/ChicagoCTABusTracker

Repository files navigation

ChicagoCTABusTracker

This app allows users to track CTA buses in real-time, providing information about routes, stops, and bus arrival predictions. It integrates the CTA Bus Tracker API to provide up-to-date bus data and utilizes several modern Android features for enhanced functionality.

App Highlights

  • SplashScreen API: Displays a splash screen while data is being loaded.
  • Location Services: Determines the user's location and displays nearby bus stops within 1000m.
  • Ad Integration: Displays banner ads in each activity using AdMob or Unity Ads.
  • Data Caching: Caches route, direction, and stop data for 24 hours for performance optimization.
  • Real-Time Bus Predictions: Shows predicted bus arrival times for selected stops.
  • Custom Alerts: Displays customer service alerts for routes and directions (Extra Credit feature).

Features

MainActivity

  • Displays all CTA bus routes.
  • A search field filters the route list based on entered text.
  • Tapping on a route shows available directions and stops within 1000m of the user’s location.

StopsActivity

  • Displays stops for the selected route and direction within 1000m of the user's location.
  • Selecting a stop opens PredictionsActivity, showing predicted bus arrivals.

PredictionsActivity

  • Displays predicted bus arrival times for the selected stop.
  • Swiping down in the PredictionsActivity refreshes bus arrival data.
  • Tapping on a prediction shows the distance and time from the selected stop.

API Integration

The app retrieves data from the CTA Bus Tracker API. The following endpoints are used:

API Endpoints:

  • getroutes: Retrieves a list of routes in the CTA system.
  • getdirections: Retrieves available directions for a specific route.
  • getstops: Retrieves bus stops for a specific route and direction.
  • getpredictions: Retrieves predictions for a specific stop or vehicle.
  • getvehicles: Retrieves current vehicle information for a specific bus.

Distance Calculation

The app uses the location services to get the user's current location and calculate the distance to each bus stop. Only stops within 1000 meters (1 km) of the user’s location are displayed. The distance is calculated using the Haversine formula or the Location.distanceTo() method.

Setup

....
 buildTypes {
        debug {
            buildConfigField("String", "API_KEY", "\"Your API KEY\"")
        }
....

Download APK for Testing

You can download the APK file for testing from the release below:


Screenshots

  • MainActivity
    Home

  • StopsActivity
Home

![sec]()
  • PredictionsActivity
Home Home Home

About

An Android app to track CTA buses in real-time, providing bus routes, stops, and arrival predictions using the CTA Bus Tracker API.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages