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
  • Create Wepin Instance
  • Initialize
  • WepinOptions
  • isInitialized
  • Register Error Listener
  • Example

Was this helpful?

  1. Deprecated
  2. Android: Java & Kotlin SDK

Initialization

Here is how to initialize the Wepin widget Android SDK.

First, create an instance of the Wepin widget. Then, use the App ID and App Key assigned after app registration to initialize the instance.

Create Wepin Instance

In the activity of your app where you want to use the Wepin widget, first create an instance of Wepin. When creating the instance, pass the activity where you want to use Wepin as a parameter.

wepin = Wepin.getInstance(MainActivity.this);

Initialize

Before using the created instance, initialize it using the App ID and App Key.

wepinOptions = new WepinOptions(appId, appKey, attributes);
wepin.initialize(widgetOptions);

WepinOptions

The interface of the WepinOptions class, which is used as a parameter for initialization, is as follows.

public class WepinOptions {
    String appId;  // App ID
    String appKey;  // App Key
    WidgetAttributes widgetAttributes;  // Widget Attributes
}

public class WidgetAttributes {
    String type;
    String defaultLanguage;
    String defaultCurrency;
}
  • appId: String App ID assigned during registration

  • appKey: String App Key assigned during registration

  • attributes: Object (optional) Properties of the Wepin Widget

    • type: String It determines how the app widget window will be displayed on initial loading. The default value is hide. show: Show the widget window immediately after loading for the first time. hide: Hide the widget window initially when loading and show it later using openWidget().

    • defaultLanguage: String The language to be displayed on the widget. The default value is ko. The currently supported languages are en and ko.

    • defaultCurrency: String The currency to be displayed on the widget. The default value is KRW. The currently supported currencies are USD and KRW.

isInitialized

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

The returned value is as follows.

  • boolean init result; true if Wepin SDK is already initialized, otherwise false.

if(wepin.isInitialized()) {
    // Success to initialize wepin
}

Register Error Listener

To handle errors that occur in the Wepin widget, implement an error listener and register it. It is not mandatory to register an error listener, as it is optional depending on your needs.

You can implement it in the activity of your app that uses the Wepin widget.

public class MainActivity extends AppCompatActivity implements WepinErrorListener {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        //...
        Wepin wepin = Wepin.getInstance(MainActivity.this);
        wepin.setErrorListener(MainActivity.this);
    }
    // ... 
    @Override
    public void onWepinError(String errorMsg)
    {
        Log.d("onWepinError : " + errorMsg);        
    }
}

Example

Wepin wepin = Wepin.getInstance(MainActivity.this);
WidgetAttributes attributes = new WidgetAttributes("hide", "ko", "KRW");
WepinOptions wepinOptions = new WepinOptions(
    "app_id_eg12sf3491azgs520", 
    "ak_test_ghq1D5s1sfG234sbnhdsw24mnovk313", 
    attributes
);

if(!wepin.isInitialized()) {
    wepin.initialize(widgetOptions);
}

PreviousInstallationNextMethods

Last updated 8 months ago

Was this helpful?