WEPIN Developer Documentation
WepinBlogContact
English
English
  • Get Started
    • Introduction
  • Wepin
    • Features
    • Architecture
      • Key Generation
      • Signing
      • Key Backup
    • Workspace
      • App Registration and Key Issuance
      • Networks and Assets Addition
      • Widget Design
    • Supported blockchains
    • Account Abstraction
  • login
    • Overview
    • Social Login Auth Providers
      • Email/Password
      • Google
      • Apple
      • Discord
      • Naver
      • Facebook
      • Line
      • Kakao
    • User Interface
    • Simplified Login
    • Resource
  • Widget Integration
    • Prerequisites
    • Web: JavaScript SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
      • PIN Pad Library
        • Installation
        • Initialization
        • Methods
      • Widget
        • Installation
        • Initialization
        • Methods
        • Final Review
      • Provider
        • Ethereum Provider
        • Kaia Provider
        • Solana Provider
        • Wagmi Connector
      • Wallet Adapter
        • Solana Wallet Adapter
    • Android: Java & Kotlin SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
      • PIN Pad Library
        • Installation
        • Initialization
        • Methods
      • Widget Library
        • Installation
        • Initialization
        • Methods
    • iOS: Swift SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
      • PIN Pad Library
        • Installation
        • Initialization
        • Methods
      • Widget Library
        • installation
        • initialization
        • Methods
    • Flutter SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
      • Widget
        • Installation
        • Initialization
        • Methods
        • Final Review
      • PIN Pad Library
        • Installation
        • Initialization
        • Methods
    • React Native SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
    • Unity SDK
      • Installation
      • Initialization
      • Methods
      • Final Review
    • Compose Multiplatform SDK
      • Login Library
        • Installation
        • Initialization
        • Methods
      • Widget
        • Installation
        • Initialization
        • Methods
        • Final Review
  • API
    • Overview
    • Registration
    • Login
    • Wallet
    • Token and NFT
    • Transaction
  • Deprecated
    • Web: JavaScript SDK
      • SDK
        • Installation
        • Initialization
        • Methods
        • Final Review
      • Provider
        • EVM-Compatible Networks
      • Wagmi Connector
    • Android: Java & Kotlin SDK
      • Installation
      • Initialization
      • Methods
      • Final Review
    • iOS: Swift SDK
      • Installation
      • Initialization
      • Methods
      • Final Review
    • Flutter SDK
      • Installation
      • Initialization
      • Methods
      • Final Review
    • React Native SDK
      • Installation
      • Initialization
      • Methods
      • Final Review
      • Providers
        • Ethereum Providers
  • MISC
    • Logo & Brand
Powered by GitBook
On this page
  • Example
  • isInitialized

Was this helpful?

  1. Widget Integration
  2. Android: Java & Kotlin SDK
  3. Login Library

Initialization

This is how to initialize the Wepin Android Login Library.

import com.wepin.android.loginlib.WepinLogin;

Before creating a WepinLogin instance, please pass the app's Activity Context, App ID, and App Key to the WepinLoginOptions object as follows.

WepinLoginOptions wepinLoginOptions = new WepinLoginOptions(this, appId, appKey);

Please create the WepinLogin instance by passing the previously created WepinLoginOptions.

WepinLogin wepinLogin = new WepinLogin(wepinLoginOptions);

After creating the WepinLogin instance, call the init method to proceed with the initialization.

wepinLogin.init()

Example

public class MainActivity extends ComponentActivity {
  private WepinLogin wepinLogin;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_example_main);

      String appId = getResources().getString(R.string.wepin_app_id);
      String appKey = getResources().getString(R.string.wepin_app_key);

      WepinLoginOptions wepinLoginOptions = new WepinLoginOptions(this, appId, appKey);
      wepinLogin = new WepinLogin(wepinLoginOptions);

      // Call initialize function
      CompletableFuture<Boolean> res = wepinLogin.init();
      res.whenComplete((infResponse, error) -> {
          if (error == null) {
              System.out.println("infResponse: " + infResponse);
          } else {
              // render error UI
          }
      });
  }
}
class MainActivity : ComponentActivity() {
    private lateinit var wepinLogin: WepinLogin
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setContentView(R.layout.activity_example_main)

        val wepinLoginOptions =  WepinLoginOptions(
            context = this,
            appId=resources.getString(R.string.wepin_app_id),
            appKey = resources.getString(R.string.wepin_app_key)
        )
        wepinLogin = WepinLogin(wepinLoginOptions)
        // Call initialize function 
        val res: CompletableFuture<Void> = wepinLogin.init()
        res.whenComplete { infResponse, error ->
            if (error == null) {
                println("infResponse: $infResponse")
            } else {
                // render error UI
            }
    }
    // ...
}

isInitialized

You can use the isInitialized method to check whether the WepinLogin instance has been initialized correctly. The return values are as follows:

  • boolean it returns true if the initialization is successful and false if the initialization fails.

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

Last updated 6 months ago

Was this helpful?