Skip to content
This repository was archived by the owner on Sep 29, 2025. It is now read-only.
/ CP Public archive

CP is a android app made for you to track your train status anywhere in Portugal

Notifications You must be signed in to change notification settings

falcaodiogo/CP

Repository files navigation

Note - Project Discontinued

It is with great sadness that I announce the end of this project. Over the past year, working with the CP API has been both fun and rewarding. Unfortunately, the API is no longer available. From now on, I’ll be using the new CP mobile app instead. This app was incredibly useful and even played a key role in helping me secure my internship at Sky Portugal. I’ll always have a special place in my heart for it, even if it no longer has a source of data. Thank you all for being part of this journey! <3

CP Mobile App

CP App is a modern application built with a combination of Material Design 3 and Material Design 3 Expressive that uses the Comboios API and CP's public API (cp.pt) to provide real-time train tracking and scheduling. Users can view upcoming trains at a specific station, track a train's delay and location, and monitor its status (stopped, entering a station, or in transit) with live updates and a progress bar.

Terms and Conditions

This project is created for educational purposes and personal use only. It utilizes the CP API strictly for coding experiments and non-commercial projects. This application is not used in any production environment or for any business-related activities.

Additionally, I have reached out to CP for permission to use the API in this manner. If there are any concerns, please feel free to contact me, and I will address them promptly.

Application Concept

CP App is a Material Design 3-based application for tracking Portuguese trains with real-time information using the Comboios API and CP's public API. The app includes the following features:

  • WelcomeScreen: Introduces the app's with an animation with haptic feedback where you can login with you Google Account or visit the CP's website.
  • HomeScreen: Serves as the main dashboard, displaying widgets about upcoming train schedules, your saved trains and shortcuts for other pages.
  • NextTrainsScreen: Shows the next trains passing through a selected station, with real-time updates on delays, arrival times, and train statuses. When you click on any train card, you can also go directly to that train page information (TrainsScreen).
  • TrainsScreen: Allows users to follow a specific train, view its location on the line, delay, if is it supressed and expected arrival time at the next station with real time information.
  • ChatBotScreen: Offers an AI-powered chatbot for user inquiries about train schedules, delays, and other services using Google Gemini.
  • SettingsScreen: Enables logging off the app, your 4 past notifications and other usefull infos about the app.

Implemented Solution

Architecture Overview (Technical Design)

  • 1. Architecture Pattern MVVM (Model-View-ViewModel): Ensures separation of concerns and a scalable structure.

  • 2. Authentication Google Firebase Authentication: Enables secure Google Account sign-in and the Gemini chatbot experience.

  • 3. Data Storage RoomDatabase: Stores user data and preferences for offline access.

  • 4. API Integration Retrofit: Handles communication with the Comboios API and CP public API. Token Service and Interceptor: Ensures secure and authenticated API requests. Google Services API: Google account loggin. Gemini API: Provides chatbot functionality for natural language queries. Google Maps: See the real time location of a train in a map.

  • 5. Real-Time Updates Uses progress bars and live data to show train delays, locations, and statuses (e.g., stopped, in transit).

  • 6. Design Material Design 3 and Material Design 3 Expressive: Implements a modern, responsive, and a very user-friendly interface with white and dark mode, accordingly to the system theme.

Resources

Project Resources:

Design

WelcomeScreen & HomeScreen

WelcomeScreen HomeScreen

Next Trains & Search by Train

Next Trains Search by Train (1)

Search by Train

Next Train (2) Search by Train (3)

Notifications

Notifications example Strike Warning

ChatBot Screen (Beta)

ChatBot Screen (Beta) ChatBot Screen (Beta)

Strike notification and themed icon

Themed Icon Settings

How to run

To execute the application, you must follow the following steps

  1. Clone the repository to your local machine.
  2. Open the "cp" app project in Android Studio.
  3. Make sure you create an Gemini API key and a Google Services API key.
  4. Run the application on an mobile emulator or physical device.

Or

  1. Download the APK available in the releases tab for Android 14 or higher

Author

Name GitHub
Diogo Falcão falcaodiogo

About

CP is a android app made for you to track your train status anywhere in Portugal

Resources

Stars

Watchers

Forks

Packages

No packages published