Android
Introduction
MiniWallet only supports the EOS network. With MiniWallet, developers can do some special actions without pulling up TokenPocket. This way can provide a better user experience.
Ready to start
Download wallet-sdk-release.aar https://github.com/TP-Lab/Mobile-SDK/blob/master/Android%20SDK/wallet-sdk-release.aar
Save the aar file to app module's libs folder. If no such folder, create it.
Add dependencies, Just add the following code to build.gradle in the app directory
dependencies {
compile(name:'wallet-sdk-release', ext:'aar')
}Deobfuscation
# tokenpocket sdk
-dontwarn com.tokenpocket.opensdk.**
-keep class com.tokenpocket.opensdk.**{*;}
-keep interface com.tokenpocket.opensdk.**{*;}How to use
Initialize SDK
Authorization This step will customize the permission group and link the operations that need to use miniwallet to the permission group
After the authorization is successful, you can use the key corresponding to the custom permission group to sign related operations
Build transaction data
Attention should be paid to this step: the permission of authorization should be filled with the name of the defined permission group.
Send transaction
Before sending a transaction, check whether the permission in the transaction data has been linked first. If not, replace the permission in the authorization of the transaction data built in the previous step with active. then pull up TokenPocket to finish this transaction. If the link has been successful, you do not need to pull up the wallet and complete the operation directly in the Dapp.
Method description
initSDK() initializes the SDK
isPermLinkAction() Checks if the permission is linked
getAccounts Get authorized accounts
clearAuth Clear authorization
auth authorize
Summarize
Demo for more details :https://github.com/TP-Lab/Mobile-SDK/tree/master/Android%20SDK/SDK_DEMO/app/src/main/java/tokenpocket/pro/sdk_demo/minwallet
Troubleshooting
Permission link failed, please check if the account has enough resources
After linking successfully, we still need to pull up TokenPocket. First, ensure the operating parameters are configured correctly. In addition, for some operations involving the security of user assets, even if the configuration is correct, it is still necessary to pull up TokenPocket to confirm.
Last updated