Installing PnP Android SDK
Add Web3Auth to Gradle
In your project-level gradle file add JitPack repository:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" } // <-- Add this line
}
}
Then, in your app-level build.gradle
dependencies section, add the following:
dependencies {
// ...
implementation 'com.github.web3auth:web3auth-android-sdk:7.1.1'
}
Latest-SDK
Check the latest version of Web3Auth's Android SDK and update accordingly.
Permissions
Open your app's AndroidManifest.xml
file and add the following permission:
<uses-permission android:name="android.permission.INTERNET" />
Note: The
<uses-permission>
element must be a direct child of the<manifest>
root element.
Configuration
Configure a Plug n Play project
- Go to Developer Dashboard, create or select a Web3Auth project.
- Add
{SCHEME}://{YOUR_APP_PACKAGE_NAME}
to Whitelist URLs. eg.w3a://com.example.w3aflutter
- Copy the
Client ID
from Project Details for initilization usage later.
Configure Deep Link
Open your app's AndroidManifest.xml
file and add the following deep link intent filter to your
Main activity
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="{scheme}" android:host="{YOUR_APP_PACKAGE_NAME}" android:path="/auth" />
<!-- Accept URIs: w3a://com.example.w3aflutter -->
</intent-filter>
Make sure your Main activity launchMode is set to singleTop in your AndroidManifest.xml
<activity
android:launchMode="singleTop"
android:name=".YourActivity">
// ...
</activity>