Features Integration

Add optional feature modules to the StreamLayer Android SDK. Set up Google PAL advertising and anonymous user authentication with dedicated Gradle dependencies.

Features Integration

The StreamLayer SDK supports optional feature modules that you add as separate Gradle dependencies. This guide covers setup for Google PAL advertising and anonymous user authentication.

Google PAL Advertising

The Google PAL module includes the com.google.android.gms:play-services-pal dependency:

dependencies {
   implementation "io.streamlayer:android-googlepal:<insert latest version>"
}

import io.streamlayer.sdk.StreamLayer
import io.streamlayer.sdk.googlepal.StreamLayerGooglePal

override fun onCreate() {
    super.onCreate()
    // above code

    StreamLayerGooglePal.initSdk(this)
}

Anonymous User Authentication

For full access to interactive features, users must be authenticated. The SDK provides several authentication methods. The simplest is anonymous authentication — the SDK assigns a user ID without collecting a phone number. Call StreamLayer.useAnonymousAuth() from any CoroutineScope:

import io.streamlayer.sdk.StreamLayer

override fun onCreate() {
    super.onCreate()
    appScope.launch{
        runCatching { StreamLayer.useAnonymousAuth() }
           .onFailure{
                // check error message here
           }
   }
}

For all authentication options, see the Authentication Forwarding Guide.


Related