open ${your flutter project} /example/app/build.gradle. reference click here
2.1 add project config and update the minSdkVersion to 23
//Modify these configurations
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.particle_auth_test"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
//After modification:
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.particle_auth_test"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 23 // required by particle sdk
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
//get from https://dashboard.particle.network/
manifestPlaceholders["PN_PROJECT_ID"] = "772f7499-1d2e-40f4-8e2c-7b6dd47db9de" //your project id
manifestPlaceholders["PN_PROJECT_CLIENT_KEY"] = "ctWeIc2UBA6sYTKJknT9cu9LBikF00fbk1vmQjsV" //your project client key
manifestPlaceholders["PN_APP_ID"] = "01a23ce8-d2e9-4b37-9eab-bf477279e53e" //your app id
}
//Modify these configurations
dependencies {
...
}
//After modification:
dependencies {
modules {
module("org.bouncycastle:bcprov-jdk15to18") {
replacedBy("org.bouncycastle:bcprov-jdk15on")
}
}
...
}
2.2 update Java Version to 11 and add dataBinding config
3.7. Configure your app scheme URL, select your app from TARGETS, under Info section, click + to add the URL types, and paste your scheme in URL Schemes
Your scheme URL should be "pn" + your project app uuid.
For example, if your project app id is "63bfa427-cf5f-4742-9ff1-e8f5a1b9828f", your scheme URL is "pn63bfa427-cf5f-4742-9ff1-e8f5a1b9828f".
3.8 In Xcode right-click your Info.plist file and choose "Open As Source Code".
Copy & Paste the XML snippet into the body of your file (<dict>...</dict>).
<key>LSApplicationQueriesSchemes</key>
<array>
<string>imtokenv2</string>
<string>metamask</string>
<string>phantom</string>
<string>bitkeep</string>
<string>trust</string>
<string>rainbow</string>
<string>zerion</string>
<string>mathwallet</string>
<string>1inch</string>
<string>awallet</string>
<string>okex</string>
</array>
<key>NSPhotoLibraryUsageDescription</key>
<string>We need access in order to open photos of barcodes</string>
<key>NSCameraUsageDescription</key>
<string>We use the camera to scan barcodes</string>
3.9 Edit Podfile, you should follow Podfile required to edit Podfile.
Initialize the SDK
Before using the SDK, you have to call init(Required)
Migrating to WalletConnect v2
Starting from version 0.14.0, WalletConnectV2 is supported.
WalletType walletType =WalletType.particle;String publicAddress ="";String result =awaitParticleWallet.switchWallet(walletType, publicAddress);print("result:$result");
Custom UI
// Set show test networkParticleWallet.setShowTestNetwork(true);// Set show manage walletParticleWallet.setShowManageWallet(true);// Set show language settingParticleWallet.setShowLanguageSetting(true);// Set show appearance settingParticleWallet.showAppearanceSetting(true);// Set support dapp browserParticleWallet.setSupportDappBrowser(false);// Set support wallet connect in wallet page.ParticleWallet.supportWalletConnect(true);// Set support add tokenParticleWallet.setSupportAddToken(false);// Set show smart account settingParticleWallet.setShowSmartAccountSetting(false);// Set display token addressesList<String> tokenAddresses =<String>["0x303b35f48684bea50D0e7D1AcDdeaf78A7188798"];ParticleWallet.setDisplayTokenAddresses(tokenAddresses);// Set priority token addressesList<String> tokenAddresses =<String>["0x303b35f48684bea50D0e7D1AcDdeaf78A7188798"];ParticleWallet.setPriorityTokenAddresses(tokenAddresses);// Set display nft addressesList<String> nftContractAddresses =<String>["0xD18e451c11A6852Fb92291Dc59bE35a59d143836"];ParticleWallet.setDisplayNFTContractAddresses(nftContractAddresses);// Set priority nft addressesList<String> nftContractAddresses =<String>["0xD18e451c11A6852Fb92291Dc59bE35a59d143836"];ParticleWallet.setPriorityNFTContractAddresses(nftContractAddresses);// set custom ui color // your custom json string.// example https://github.com/Particle-Network/particle-ios/blob/main/Demo/Demo/customUIConfig.jsonconst json ="";ParticleWallet.loadCustomUIJsonString(json);
Set custom Wallet name and icon
ParticleWallet.setCustomWalletName("Your Wallet Name", "your wallet icon url");// in Android platform, call setWallet and set your wallet name.ParticleWallet.setWallet(walletType, pubAddress!, "Your wallet name");
Set custom localizable
// you can replace localizable strings that appeared in // yourIOSBuild/Pods/ParticleWalletGUI/XCFrameworks/ParticleWalletGUI/ParticleWalletGUI.bundle/en.lproj/Locallizable.strings.
if (Platform.isIOS) {Map<String, String> enLocalizables =<String, String>{"network fee":"Service Fee","particle auth wallet":"Your wallet name" };Map<Language, Map<String, String>> localizables =<Language, Map<String, String>> {Language.en: enLocalizables };ParticleWallet.setCustomLocalizable(localizables);}