Android SDK
This page explains how to use App2App Android SDK to use Klip on your BApp.
Prerequisites
API 16: Android 4.1 (Jelly Bean) or higer
Java 8 or higher
Android Studio 3.0.0 or higher
Android Permission: Internet Permission
Environment Setup
Klip JavaScript SDK doesn't require a separate registration process and works in any environments where HTTP communication is possible. But since user's consent is received using the mobile app Klip, you need to have Klip installed to make the requests.
You can find a guide for executing Klip Android SDK Sample App in README.md
.
1. Download Klip SDK
Download Klip Android SDK in Download.
2. Add Klip SDK Library
Option 1. Build Klip SDK and add to your project
Run Terminal at the location of downloaded Klip SDK project
Run the command
./gradlew :sdk:build
and build Klip SDK project (When building is complete, an AAR file is created at /sdk/build/outputs/aar/)Create a libs directory in the project
Copy the built AAR file to the project's libs directory
Add directory reference and dependency to the project's
build.gradle
If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).
Option 2. Import Klip SDK source code and add to your project
Run the project in Android Studio
Android Studio > File > New > Import Module
Select the sdk directory in the Klip SDK project downloaded in the Source Directory, and click Next
Copy
gradle.properties
in the Klip SDK project to your projectAdd the dependency setting in
build.gradle
of your project
Once the Klip SDK source is copied to your project, you can modify the library code yourself. This may not be a suitable option if you want to maintain single version library code. In this case, add the compiled AAR file as directed in Option 1.
3. Add Permission
In order to enable HTTP communication on Klip SDK, add android.permission.INTERNET
in the AndroidManifest.xml
file as shown below:
If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).
API
Overview
App2App API requests are made in the order: prepare
, request
, and getResult
.
prepare
is the step in which requests (from of a total of five) are definedrequest
is the step in which the function is called and the signing takes place on KlipgetResult
is the step in which the result is returned from the function call
In addition, getCardList
is a function provided for the convenience of BApp developers that returns a list of NFTs of a Klip user.
If you need help with this document or Klip in general, please visit our Developer Forum.
KlipGlobal.getInstance
Creates an instance to use Klip SDK.
Parameters
Return Value
Example
If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).
Klip.prepare
Prepares to process an App2App API request and issues a request key.
Request Objects
Connecting Klip(=authentication)
AuthRequest
Sending KLAY
KlayTxRequest
Sending Token
TokenTxRequest
Sending Card
CardTxRequest
Executing Contract
ContractTxRequest
Parameters
Throws
Requesting consent to Klip users will return the data entered in request
and bappInfo
. The request key returned in the response serves as a key when requesting transactions to users, and is used with KlipSDK.shared.getResult and KlipSDK.shared.request.
Example 1. Obtaining User Information
Example 2. Sending KLAY
Example 3. Sending Tokens
Example 4. Sending Card
Example 5. Executing Contract
If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).
Klip.request
Requests authentification or signature using deep link. If the device doesn't have Klip installed, it redirects automatically to the download page on Google Play. To implement the request step using QR code, please refer to QR Code Tutorial.
Parameters
Throws
Example
If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).
Klip.getResult
Returns the result of an App2App API request.
Parameters
Throws
Example
If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).
Klip.getCardList
Returns a list of certain Cards of a user.
Parameters
Throws
Example
If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).
Error Code
You can see the error code via getErrorCode()
in KlipErrorResponse
, which is the fail response of KlipCallback
.
If you need help with this document or Klip in general, please visit our [Developer Forum](https://klipforum.zendesk.com).
Last updated