Initialization

This guide explains how to initialize the Wepin Compose Multiplatform Login Library.

After installing the Wepin Compose Multiplatform Login Library, the next step is to initialize the SDK. SDK initialization involves creating an instance of WepinLogin and using the init() function to proceed.

Import SDK

To use the Wepin Compose Multiplatform Login Library, you first need to import the SDK. Add the following import statements:

import com.wepin.cm.loginlib.WepinLogin
import com.wepin.cm.loginlib.types.*

Creating and Initializing the WepinLogin Instance

Before creating an instance of WepinLogin, you must register your app's Android/iOS information in the Wepin Workspace.

Using the registered app information, create an instance of WepinLogin.

private val wepinLogin: WepinLogin = WepinLogin(
    WepinLoginOptions(
        context = context,    //Android: Context, ios: UIViewController
        appId = appId,
        appKey = appKey
    )
)
wepinLogin.init()

Checking Initialization Status (isInitialized)

You can check whether the WepinLogin instance has been successfully initialized by using the isInitialized method.

The return value is as follows:

  • <Boolean> Returns true if initialization was successful, and false if it failed.

if(wepinLogin.isInitialized()) {
    // Success to initialize WepinLogin
}

Last updated