Android Integration Guide
Wallet Core is available on the Android platform, through Java/JNI bindings. In this guide we show how to use it.
A sample application is available at: https://github.com/trustwallet/wallet-core/tree/master/samples/android .
Prerequisites
Android Studio
Android NDK Support plugin
Adding Library Dependency
Android releases are hosted on GitHub packages, It needs authentication to download packages, please checkout this guide from GitHub for more details.
We recommend to create a non-expiring and readonly token for accessing GitHub packages, and add it to local.properties
of your Android Studio project locally.
Generate a token here:
Add this dependency to build.gradle:
Add maven
and credentials
(local.properties
for local or system environment variables CI)
Code Examples
In the following sections we show code examples for some common funcions. Please refer to the Wallet Usage Guide for detailed explanations.
Wallet Management
First thing we need is to load JNI library
Creating or Importing a Multi-Coin HD Wallet
Account Address Derivation
Generating the Default Address for a Coin
Generating an Address Using a Custom Derivation Path (Expert)
Transaction Signing
In general, when creating a new blockchain transaction, a wallet has to:
Put together a transaction with relevant fields (source, target, amount, etc.)
Sign the transaction, using the account private key. This is done by Wallet Core.
Send to a node for broadcasting to the blockchain network.
Ethereum Transaction Signing
Code example to fill in signer input parameters, perform signing, and retrieve encoded result:
Last updated