To use features of Tron like sending of TRX, TRC10, and TRC20 token, you need to use a call method through the TronService class that inherits the CoinService interface. The TronService class is available to get from the CoinServiceFactory.getCoinService().
Get TronService
CoinServiceFactory includes getCoinService, a static method to get the specific inherited CoinService.
If you want to use TronService, a CoinNetworkInfo that assigns CoinType.TRX is required. After creation, reassigning of CoinNetworkInfo is not allowed. If you want to change the NetworkType or RPC_ENDPOINT, you should create a new instance through the CoinServiceFactory.getCoinService().
An account has a TronTokenType which affects sendTokenTransaction and getTokenBalance.
sendRawTransaction - Sends a raw transaction. This API can be blocked with the AvailabilityException by the SDK’s availability of the smart contract in case of critical issue or Tron’s own problem.
sendTransaction – Sends a TRX. It requires a connected HardwareWallet instance that can sign with the user’s private key. This API can be blocked with the AvailabilityException by the SDK’s availability of the smart contract in case of critical issue or Tron’s own problem.
sendTokenTransaction – Sends a Tron Token (TRC10, TRC20 by account type) transaction with parameters. It requires a connected HardwareWallet instance that can sign with the user’s private key. This API can be blocked with the AvailabilityException by the SDK’s availability of the smart contract in case of critical issue or Tron’s own problem.
try{
tronService.sendTokenTransaction(
connectedWallet,
tronTokenAccount,
toAddress,newBigInteger("1000")// value of TRC10 or TRC20 by account).setCallback(newListenableFutureTask.Callback<TransactionResult>(){@OverridepublicvoidonSuccess(TransactionResult result){//success}@OverridepublicvoidonFailure(ExecutionException exception){//failure}@OverridepublicvoidonCancelled(InterruptedException exception){//cancelled}});}catch(AvailabilityException e){//handle exception}
getTokenBalance – Get Tron Token (TRC10, TRC20 by account type) balance with parameters. This API can be blocked with the AvailabilityException by the SDK’s availability of the smart contract in case of critical issue or Tron’s own problem.
sendSmartContractTransaction – Sends a Tron Smart Contract transaction with parameters. It requires a connected HardwareWallet instance that can sign with the user’s private key. This API can be blocked with the AvailabilityException by the SDK’s availability of the smart contract in case of critical issue or Tron’s own problem.
getTransactionDetail – Gets the detailed information for a single Tron transaction by txId. It will return as a TronTransaction that contains the transaction data like block number, hash, value, and etc.
We use cookies to improve your experience on our website and to show you relevant
advertising. Manage you settings for our cookies below.
Essential Cookies
These cookies are essential as they enable you to move around the website. This
category cannot be disabled.
Company
Domain
Samsung Electronics
.samsungdeveloperconference.com
Analytical/Performance Cookies
These cookies collect information about how you use our website. for example which
pages you visit most often. All information these cookies collect is used to improve
how the website works.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Functionality Cookies
These cookies allow our website to remember choices you make (such as your user name, language or the region your are in) and
tailor the website to provide enhanced features and content for you.
Company
Domain
LinkedIn
.ads.linkedin.com, .linkedin.com
Advertising Cookies
These cookies gather information about your browser habits. They remember that
you've visited our website and share this information with other organizations such
as advertisers.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Preferences Submitted
You have successfully updated your cookie preferences.