Skip to content

skedgo/tripkit-android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TripKit for Android

Build Status

Set up TripKit

Add TripKit to your Android project

First, add JitPack maven:

allprojects {
  repositories {
    jcenter()
    maven { url "https://jitpack.io" }
  }
}

Then, in app's build file, add TripKitAndroid dependency into dependencies section:

dependencies {
  implementation 'com.github.skedgo:tripkit-android:<insert-newest-version-here>'
}

Release

For a full setup, you can have a look at TripKitSamples' build file here.

Required configuration

Supported Android versions

TripKit supports for Android apps running Android 4.0.3 and above. To make sure that it works in your Android app, please specify minSdkVersion in your build.gradle file to 15:

android {
  defaultConfig {
    minSdkVersion 16
  }
}

Add android.enableJetifier=true on your gradle.properties file

android.useAndroidX=true
....
android.enableJetifier=true
Get an API key

An API key is necessary to use TripKit's services, such as A-2-B routing, and all-day routing. In order to obtain an API key, you can sign up at https://tripgo.3scale.net.

Create TripKit instance to access TripKit's services

We recommend to have an Application subclass. Next, in the onCreate() method, you can initiate following setup:

for >= v2.1.43

class App : Application() {
  override fun onCreate() {
    super.onCreate()
    
    TripKitConfigs.builder().context(this)
            .debuggable(true)          
            .key { key }
            .build()

	val httpClientModule = HttpClientModule(null, null, configs)

	val tripKit = DaggerTripKit.builder()
                .mainModule(MainModule(configs))
                .httpClientModule(httpClientModule)
                .build()

    TripKit.initialize(this, tripKit)            
  }
}

With "YOUR_API_KEY" is the key that you obtained from https://tripgo.3scale.net in the previous step.