VOOZH about

URL: https://www.geeksforgeeks.org/android/how-to-build-live-train-status-app-in-android/

⇱ How to Build Live Train Status App in Android? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to Build Live Train Status App in Android?

Last Updated : 23 Jul, 2025

Imagine you are traveling via Indian railways which is one of the biggest rail networks in the world. You want to get real-time updates for the train on which you are traveling so that you can plan accordingly. In this article, we will take a look at How to build a live train status checker application in Android. We will be using a method of web scraping to build this application to check live train status. A sample video is given below to get an idea about what we are going to do in this article.



Step-by-Step Implementation

Step 1 : Create a new android studio project

To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio. Note that select Kotlin as the programming language.

Step 2: Add the below dependency in your build.gradle file

Below is the dependency for JSOUP which we will be using to scrap the data for our application. For adding this dependency navigate to the app > Gradle Scripts > build.gradle(app) and add the below dependency in the dependencies section.

implementation ("org.jsoup:jsoup:1.11.2")
implementation ("com.squareup.okhttp3:okhttp:4.9.1")

After adding this dependency sync your project and now move toward the AndroidManifest.xml part.  

Step 3: Adding permissions to the internet in the AndroidManifest.xml file

Navigate to the app > AndroidManifest.xml and add the below code to it. 

Step 4: Working with the activity_main.xml file

Navigate to the app > res > layout > activity_main.xml and add the below code to that file. Below is the code for activity_main.xml file.

Step 5: Working with MainActivity.kt file

Navigate to app>java>your app's package name>MainActivity.kt file. Add below code to it. Comments are added in the code to get to know in detail.

Now run your application to see the output of the application.

Output:



Comment

Explore