Lens Lite for Android
Veryfi Lens Lite is a lightweight version of Veryfi Lens SDK intended for Instant Apps.
Obtaining Client ID and User Keys
You need two sets of credentials:
- Maven credentials to download the SDK (Maven username and password)
- Access credentials to access to the Veryfi API (Client ID, API key, username, URL)
If you don't have an account with Veryfi, please register here: https://app.veryfi.com/signup/api/
In the Veryfi hub, go to
Settings
>Keys
:- In the
API Auth Credentials
section, you can get your API credentials. - In the
Lens: Maven (Android)
section you can create your Maven credentials.
- In the
Add your Maven credentials to your system environment (e.g.,
~/.zshrc
). Replace[MAVEN_USERNAME]
and[MAVEN_PASSWORD]
with the credentials obtained in the previous step.export MAVEN_VERYFI_USERNAME=[USERNAME]
export MAVEN_VERYFI_PASSWORD=[PASSWORD]
Create an Instant App module
- Create a new module for your existing app in Android Studio:
File
>New
>New Module...
- Select a
Phone & Tablet
module and fill in the required fields. - IMPORTANT: Use the same
applicationId
as your full app for your Instant App (applicationId
inapp/build.gradle
) - In the new module's
AndroidManifest.xml
file:- Set the target sandbox.
- Declare your module as an instant-enabled app.
- Add your launch activity and associate an App Link to open it from a URL (More info: Create App Links for Instant Apps).
- Add
INSTANT_APP_FOREGROUND_SERVICE
permission. - Add a
default-url
.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:dist="http://schemas.android.com/apk/distribution"
android:targetSandboxVersion="2">
<dist:module dist:instant="true" />
<uses-feature android:name="android.hardware.sensor.light" android:required="false" />
<uses-feature android:name="android.hardware.camera.any" android:required="false" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-feature android:name="android.hardware.camera.flash" android:required="false" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INSTANT_APP_FOREGROUND_SERVICE" />
<uses-permission android:name="${applicationId}.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION" tools:node="remove" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="remove" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:node="remove" />
<application ...>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="your.domain.com" />
<data android:pathPrefix="/instantapp/" />
</intent-filter>
<meta-data
android:name="default-url"
android:value="https://your.domain.com/instantapp/" />
</activity>
</application>
</manifest>
- In the new module’s
build.gradle
file:
android {
namespace 'YOUR_PACKAGE_NAME_HERE'
defaultConfig {
applicationId "YOUR_PACKAGE_NAME_HERE"
minSdk 26
targetSdk 35
...
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
}
}
buildTypes {
release {
minifyEnabled true
...
}
}
androidResources {
noCompress += 'veryfi'
}
...
}
repositories {
mavenCentral()
maven {
url "https://nexus.veryfi.com/repository/maven-releases/"
credentials {
username System.getenv("MAVEN_VERYFI_USERNAME")
password System.getenv("MAVEN_VERYFI_PASSWORD")
}
authentication {
basic(BasicAuthentication)
}
}
}
dependencies {
implementation "com.veryfi.lens:veryfi-lens-lite-sdk:2.1.0.28"
implementation "com.google.android.gms:play-services-instantapps:18.1.0"
...
}
The minimum SDK version is 26, and only
armeabi-v7a
andarm64-v8a
ABIs are supported.Publish an
assetlinks.json
file on the website corresponding to your App Link (e.g.,https://your.domain.com/.well-known/assetlinks.json
)
[
{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "YOUR_PACKAGE_NAME_HERE",
"sha256_cert_fingerprints": ["XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX"]
}
}
]
- To get the SHA-256 certificate fingerprint, go to the Google Play Console and select your app >
Test and release
>Setup
>App signing
, then copy the SHA-256 certificate fingerprint under theApp signing key certificate
section:

- To run your Instant App, modify your existing
run/debug configuration
as follows:- Select
Run
>Edit Configurations
from the menu bar. - In the left panel, select your Instant App module.
- Enable
Deploy as instant app
. - Optionally, to launch the Instant App from an App Link with parameters: select
URL
in theLaunch
dropdown, and add yourURL
(e.g.,https://your.domain.com/instantapp/?param1=value1¶m2=value2
).
- Select


Implement your launch activity like a normal app, following the documentation: https://docs.veryfi.com/lens/mobile/receipts/initialization/
When your Instant App is ready for publishing, create a
Google Play Instant
form factor in the Google Play Console:Test and release
>Setup
>Advanced settings
>Form factors

- Before creating a new release, select the
Instant apps only
form factor:

- For more information on Instant Apps: Create an instant-enabled app bundle