Skip to content

Create EV Client

To use EV features, EvService needs to be initialized and an EvClient instance needs to be created. The EvService#initialize(SDKOptions, EvSettings) method will only need to be called once.

Create EV Client

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
try {
    SDKOptions sdkOptions = SDKOptions.builder()
            .setApiKey("#API_KEY_PROVIDED_BY_TELENAV#")
            .setApiSecret("#API_SECRET_PROVIDED_BY_TELENAV#")
            .setCloudEndPoint("#CLOUD_ENDPOINT_PROVIDED_BY_TELENAV#")
            .setLocale(Locale.EN_US)
            .build();

    EvSettings evSettings = EvSettings.builder()
            .setCapacityInKwh(90)
            .setMaxRangeInKm(600)
            .build();

    EvService.initialize(sdkOptions, evSettings);
} catch (EvInitializationFailedException | EvClientImplNotFoundException e) {
    // SDK init error, check your API key/secret, cloud endpoint and lib dependencies
}

EvClient evClient = EvService.getClient();
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
try {
    val sdkOptions = SDKOptions.builder()
            .setApiKey("#API_KEY_PROVIDED_BY_TELENAV#")
            .setApiSecret("#API_SECRET_PROVIDED_BY_TELENAV#")
            .setCloudEndPoint("#CLOUD_ENDPOINT_PROVIDED_BY_TELENAV#")
            .setLocale(Locale.EN_US)
            .build()

    val evSettings = EvSettings.builder()
            .setCapacityInKwh(90)
            .setMaxRangeInKm(600)
            .build()

    EvService.initialize(sdkOptions, evSettings);

} catch (e: EvInitializationFailedException) {
    // SDK init error, check your API key/secret, cloud endpoint and lib dependencies
} catch (e: EvClientImplNotFoundException) {
    // SDK init error, check your API key/secret, cloud endpoint and lib dependencies
}

var evClient = EvService.getClient()


The SDK is now ready to use!