Skip to content

JPrendy/bus-timetable-okhttp-kotlin-application

Repository files navigation

Bus timetable Okhttp Kotlin application

Description

The following is a simple Kotlin application that uses Okhttp to fetch rest api data that is then shown on the activity screen of the application.

Contents

Setup Steps

Go to the app module build.gradle and add the following test dependency

implementation("com.squareup.okhttp3:okhttp:4.7.2")
implementation("com.google.code.gson:gson:2.8.6")
androidTestImplementation "com.squareup.okhttp3:mockwebserver:4.6.0"
androidTestImplementation 'androidx.test:rules:1.1.1'
androidTestImplementation 'androidx.test.ext:truth:1.1.0'
androidTestImplementation 'com.jakewharton.espresso:okhttp3-idling-resource:1.0.0'

Go to the AndroidManifest.xml and allow internet permission

<uses-permission android:name="android.permission.INTERNET"/>

How to run the project locally

Code here

Helpful resources

Issues related to the emulator not connecting to the internet.

Great video on how to fetch JSON with OkHttp and Gson with Kotlin.

OkHttp official references for asynchronous get examples in Kotlin

About

A Kotlin Application that uses Dublin bus API to show when the next available bus will arrive. It uses OkHttp.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages