Android Examples

< Back

This document contains practical examples of using the Locator SDK for Android.

Complete Initialization and Configuration Example

This example shows the complete flow of initialization, configuration, and starting the Locator SDK.

1. Basic Initialization

Basic SDK initialization is done in the Application:

class MyApplication : Application() {

    override fun onCreate() {
        super.onCreate()
        // Basic initialization
        LocatorSDK.initialize(initContext = this)
    }
}

2. Initialization with Configuration

Alternatively, you can initialize the SDK by passing the configuration directly to the initialize method:

⚠️ IMPORTANT: Before calling start(), it is necessary to set the SDK state using setState(LocatorState.IDLE). See section 3 for the complete example.

3. Complete Flow: Get Instance, Configure and Start

Complete example showing the entire configuration flow:

⚠️ IMPORTANT: Before initializing the SDK, it is necessary to set the SDK state. To enable SDK functionality for users with the feature, call the setState method with LocatorState.IDLE value before calling start().

For a cleaner architecture, you can use ViewModel:

⚠️ IMPORTANT: Remember to call setState(LocatorState.IDLE) before start() in the startSDK() method.

Models

To see the complete models in Kotlin, see Models.

Last updated