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
  • Example
  • changeLanguage
  • Parameters
  • Return value
  • Example

Was this helpful?

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

Initialization

The method for initializing the Wepin Android Widget Library is as follows.

import com.wepin.android.widgetlib.WepinWidget

Before creating an instance of WepinWidget, please pass the app’s Activity Context, the app ID, and the app key assigned after app registration to the WepinWidgetParams object as shown below.

val wepinWidgetParams =  WepinWidgetParams(
            context = this,
            appId = "your-wepin-app-id",
            appKey = "your-wepin-app-key"
        )

Please create a WepinWidget instance by passing the previously created WepinWidgetParams.

val wepinWidget = WepinWidget(wepinPinParams)

After creating the WepinWidget instance, call the initialize method to complete the initialization.

val res = wepinWidget.initialize(attributes)

parameters

atrributes <WepinWidgetAttributes>

  • defualtLanguage <String> The default language setting for the Widget screen is 'en'. Currently supported languages are 'ko', 'en', and 'ja'.

  • defualtCurrency <String> The default currency setting for the Widget screen is 'USD'. Currently supported currencies are 'KRW', 'USD', and 'JPY'.

Return value

CompletableFuture <Boolean> Returns true if successful, and false if it fails.

Example

public class MainActivity extends ComponentActivity {
    private WepinWidget wepinWidget;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_example_main);

        initView();

        // Initialize Wepin PIN Pad Library 
        WepinWidgetParams wepinWidgetParams = new WepinWidgetParams(
            this,
            "your-wepin-app-id",
            "your-wepin-app-key"
        );
        wepinWidget = new WepinWidget(wepinWidgetParams);
        
        WepinWidgetAttributes attributes = new WepinWidgetAttributes("en", "USD);
        CompletableFuture<InfResponse> res = wepinPin.initialize(attributes);
        if (res != null) {
            res.whenComplete((infResponse, error) -> {
                if (error == null) {
                    System.out.println(infResponse);
                } else {
                    System.out.println(error);
                }
            });
        }
        // ...
    }
}
class MainActivity : ComponentActivity() {
    private lateinit var wepinWidget: WepinWidget
    override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

        setContentView(R.layout.activity_example_main)
    
        initView()
        
        // Initialize Wepin PIN Pad Libary 
        val wepinWidgetParams =  WepinWidgetParams(
            context = this,
            appId = 'your-wepin-app-id',
            appKey = 'your-wepin-app-key'
        )
        wepinWidget = WepinWidget(wepinWidgetParams)       
        var attributes = WepinWidgetAttributes("en", "USD")
        val res = wepinWidget.initialize(attributes)
        res?.whenComplete { infResponse, error ->
          if (error == null) {
            println(infResponse)
          } else {
            println(error) 
          }
      }        
    // ...
}

isInitialized

You can use the isInitialized method to check if the WepinPin instance has been successfully initialized.

The return values are as follows

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

Example

if(wepinWidget.isInitialized()){
    // Success to initialize WepinPin
}
if(wepinWidget.isInitialized()){
    // Success to initialize WepinPin
}

changeLanguage

wepinWidget.changeLanguage("ko")

Changes the language displayed on the Widget screen. Currently, only 'ko', 'en', and 'ja' are supported.

Parameters

  • language <String>

Return value

  • CompletableFuture <Boolean> Returns true if successful and false if it fails.

Example

wepinWidget.changeLanguage("ko").whenComplete((res, err) -> {
    if (err == null) {
        System.out.println(res);
    } else {
        System.out.println(err);
    }
});
wepinWidget.changeLanguage("ko").whenComplete{ res, err ->
    if (err == null) {
      println(res)
    } else {
      println(err)
    }
}
PreviousInstallationNextMethods

Last updated 25 days ago

Was this helpful?