Android AAR SDK for Referer
Artifact
Section titled “Artifact”lib.apkreferer:reader:1.0.0The SDK is delivered as an AAR. It supports Android API 24 and later.
Add the SDK
Section titled “Add the SDK”Put the AAR in your app’s libs/ directory:
dependencies { implementation(files("libs/apk-referer-reader-1.0.0.aar"))}If you use an internal Maven repository, publish the AAR there and use the coordinates above.
Read the channel parameter
Section titled “Read the channel parameter”import lib.apkreferer.reader.RefererReaderimport lib.apkreferer.reader.RefererResult
val result = RefererReader.read(context)when (result) { is RefererResult.Found -> { val referer = result.referer // Use the channel parameter in your business logic. } RefererResult.NotFound -> { // This APK has no channel parameter. } is RefererResult.Error -> { // result.code / result.message }}read() is synchronous and creates no thread. Call it from a background thread. It reads only the current app’s installed APK and needs no storage permission.
Results
Section titled “Results”Found: the channel parameter was found and is returned as a string.NotFound: the APK is valid but has no channel parameter.Error: the APK is missing, unreadable, unsupported, or the parameter is invalid. Usecodefor program logic andmessagefor diagnostics.
The SDK never logs the full channel value. Handle Error in your app; do not assume a value is always present.