⌘K

DevKit

DevKit provides live features such as real-time updates, screen sharing, notification permissions, remote logging, and screen management for Nativeblocks applications. It is specifically designed to work with the Nativeblocks Studio environment.


DevKit

class DevKit : Wandkit

Inheritance

Implements: Wandkit


Builder

DevKit uses the Builder pattern for configuration. Initialize using DevKit.Builder().

class Builder {
    fun keepScreenOn(): Builder
    fun autoConnect(): Builder
    fun enableLogging(): Builder
    fun build(): DevKit
}

Builder Methods

keepScreenOn()

Sets whether to keep the device screen on during live sessions. When enabled, the device screen will stay on and won't auto-lock.

fun keepScreenOn(): Builder

Returns: This builder instance for method chaining.

autoConnect()

Sets whether to automatically connect to the live service. When enabled, the SDK will automatically connect to Nativeblocks Studio on startup.

fun autoConnect(): Builder

Returns: This builder instance for method chaining.

enableLogging()

Enables logging to transmit log events to Nativeblocks Studio. When enabled, application logs will be sent to Studio for debugging.

fun enableLogging(): Builder

Returns: This builder instance for method chaining.

build()

Builds and returns a configured DevKit instance.

fun build(): DevKit

Returns: A new DevKit instance with the configured settings.


destroy()

Cleans up resources and cancels any active operations associated with DevKit.

override fun destroy()

Sample Usage

Here's an example of how to configure and use DevKit in an Android application:

import android.app.Application
import io.nativeblocks.core.api.NativeblocksManager
import io.nativeblocks.wandkit.DevKit

class MyApplication : Application() {

    override fun onCreate() {
        super.onCreate()

        // Initialize NativeblocksManager
        NativeblocksManager.initialize()

        // Configure DevKit for debug builds
        if (BuildConfig.DEBUG) {
            val devKit = DevKit.Builder()
                .keepScreenOn()
                .autoConnect()
                .enableLogging()
                .build()

            NativeblocksManager.getInstance().wandkit(devKit)
        }
    }
}