Configuring settings.gradle
settings.gradle
file is structured/configured to use Maven; below is an example of how this file should look.Configuring the Particle dashboard
build.gradle
, we’ll need to first retrieve three key values from the Particle dashboard.These values include your: projectId
, clientKey
, and appId
. Using these keys, you’ll be able to link your instance of Particle Connect with a project configured on the dashboard.To retrieve these, follow the below steps.Access the Particle Dashboard
Create a new project or enter an existing project
Create a new application, or skip this step if you already have one
Retrieve the project ID (`projectId`), the client key (`clientKey`), and the application ID (`appId`)
Configuring build.gradle
build.gradle
file. Here, you’ll establish the various SDKs used within your application and plug in the aforementioned keys.Specifically, you’ll need the following libraries:network.particle:connect
network.particle:connect-kit
network.particle:connect-auth-core-adapter
network.particle:api-service
network.particle:connect-evm-adapter
, for onboarding via EVM private key. (not recommended)network.particle:connect-solana-adapter
, for onboarding via Solana private key. (not recommended)network.particle:connect-phantom-adapter
, if using Phantom.network.particle:connect-wallet-connect-adapter
,network.particle:wallet-service
, if you’d like to use Particle’s embedded wallet interface.network.particle:aa-service
, if you’d like to use ERC-4337 account abstraction.build.gradle
file should look similar to the following (replace the placeholder values with the previously retrieved keys and proper SDK versions).Configuring AndroidManifest.xml
build.gradle
file ready to go, the final point of configuration needed is within AndroidManifest.xml
, in which you’ll have to insert the previously retrieved project keys once again.Below is an example of this file with areas in which project keys are needed highlighted.Initializing Particle Connect
settings.gradle
, build.gradle
, and AndroidManifest.xml
), it’s time to initialize Particle Connect within your application.This is done through ParticleConnect.init
, which takes the following parameters:application
, which represents the underlying Android application.env
, either env.PRODUCTION
, env.DEV
, or env.STAGING
; this alters the information logged when running the application.chain
, a ChainInfo
object (from network.particle.chains.ChainInfo.Companion.{chain}
) that represents the primary chain you intend to use.dAppData
, metadata for your application to be used with WalletConnect.createAdapters
, a list of wallets (adapters imported from com.wallet.connect.adapter.{Adapter}
) that you’d like to support within your application.ParticleConnect.init
has been included below.Opening connection modal
ParticleConnectKit.connect
, passing an instance of ConnectKitConfig
, as exemplified below.ParticleConnectKit.connect
call, which will contain core properties such as publicAddress
after an account is loaded.
Additionally, to explicitly retrieve detailed information, you can call AuthCore.getUserInfo
, which will return a userInfo
object with various properties detailing the connection method used, addresses, and so on (to learn more about the structure of this object, head over to its API reference).
ParticleNetwork.evm.createTransaction
(or the solana
equivalent), passing in standard parameters such as from
, to
, value
, and (if you’re interacting with a contract) data
. Using these, an object will be returned which can be used directly for execution.
Execution needs to be initiated through an instance of the active connector, or adapter (the method in which a user connected); this can be retrieved and loaded using ParticleConnect.getAdapters
, as demonstrated below. Upon loading the adapter, you can simply call {adapter}.signAndSendTransaction
, passing in the previously generated transaction object. Upon doing so, the user will be prompted to confirm the transaction.