Skip to content

Expert Android

💻 Setup

Add the following dependency in the build.gradle file of your application:

dependencies {
    implementation("com.kisio.navitia.sdk.data:expert:3.5.2")
}

👨‍💻 Implementation

This module is set up by calling ExpertSdk.getInstance(). The singleton behaves like a builder in which each method allows you to configure the module. Then, you need to call the init() method at the end. You should call this method in an Application subclass.
This method takes the following parameters:

Name Required Description Type Default
token Get your token String
env Environment in which the module is launched NavitiaEnvironment

Example

val expertSdk = ExpertSdk.getInstance().apply {
    init(
        token = "your_token",
        env = NavitiaEnvironment.PROD
    )
}

🚀 Launching

You can now call any endpoint from expertSdk and its variety of builders that will help you request Navitia. As an example:

try {
    val request = expertSdk.physicalModesApi.getCoverageRegionPhysicalModes(
        region = "your_coverage"
    )
    if (request.isSuccessful) {
        val result = request.body() as PhysicalModes
        // Handle result
    } else {
        // Handle failure
    }
} catch (ex: Exception) {
    // Handle failure exception
}