Skip to main content

Installing PnP Android SDK

Installation

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:8.0.3'
}

Update Permissions

Open your app's AndroidManifest.xml file and add the following permission. Please make sure the <uses-permission> element should be a direct child of the <manifest> root element.

<uses-permission android:name="android.permission.INTERNET" />

Configure AndroidManifest File

Make sure your Main activity launchMode is set to singleTop in your AndroidManifest.xml

<activity
android:launchMode="singleTop"
android:name=".YourActivity">
// ...
</activity>

From version 7.1.2, please make sure to set android:allowBackup to false, and add tools:replace="android:fullBackupContent" in your AndroidManifest.xml file.

<application
android:allowBackup="false"
tools:replace="android:fullBackupContent"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher">
</application>

Configuration Redirection

Once the gradles and permission has been updated, you need to configure Web3Auth project by whitelisting your scheme and package name.

Configure a Plug n Play project

  • Go to Web3Auth Developer Dashboard, and create or open an existing Web3Auth project.
  • Whitelist {SCHEME}://{YOUR_APP_PACKAGE_NAME} in the developer dashboard. This step is mandatory for the redirect to work.

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="/path" />
<!-- Accept URIs: w3a://com.example.w3aflutter -->
</intent-filter>