Using the SBlockchain class

The following code shows how to use SBlockchain class methods:

try {
    SBlockchain sblockchain = new SBlockchain();
    sblockchain.initialize(context);
} catch (SsdkUnsupportedException e) {
    if (e.getErrorType() == VENDOR_NOT_SUPPORTED){
        Log.e("error", "Platform SDK is not support this device");
    }
}

The SBlockchain class provides the following methods:

  • Initialize (Context) - Initializes an instance of the Samsung Blockchain SDK.

  • getAccountManager - Returns the AccountManager that manages the Account. The AccountManager is a singleton instance.

  • getHardwareWalletManager - Returns the HardwareWalletManager managing the HardwareWallet. The HardwareWalletManager is a singleton instance.

  • getSupportedHardwareWallet - Get the supported hardware wallet types of Blockchain SDK.

  • getVersionCode - Returns the version number of the Samsung Blockchain SDK.

  • getVersionName - Returns the version name of the Samsung Blockchain SDK.

Using the initialize() method

The SBlockchain initialize method:

  • Initialize SBlockchain instance.

  • Checks if the Samsung device is supported.

If the initialization of SBlockchain failed, the initialize() method throws an SsdkUnsupportedException exception. To find out the reason for this exception, check the exception message.

Handling SsdkUnsupportedException

If an SsdkUnsupportedException exception is thrown, check the exception message type using SsdkUnsupportedException.getType().

The following type of exception message needs to be handled: VENDOR_NOT_SUPPORTED: The device is not a Samsung device