Import DeviceFingerprint.aar
DeviceFingerprint.aar
to your libs
directoryAdd following line to your app's build.gradle
file at the dependencies section:
compile files('../libs/DeviceFingerprint.aar')
Compile Options
Make sure the app's build.gradle
file contains the following code snippet within android section
(starting from Android Studio 4.1 this snippet is present when creating a new project):
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
Permissions
The SDK uses following permissions,make sure your app got the permissions before start
android.permission.INTERNET
Init, start and get result
deviceFingerprint?.setAccessToken(Config.accessToken)
deviceFingerprint?.setMarket(Config.market)
deviceFingerprint?.start() { success, dfpId, detailMsg ->
showLoading(false)
if (success) {
tv_result.text = dfpId
} else {
tv_result.text = detailMsg
}
}
If it is successful, A dfpId will be returned, which can be used to query the the corresponding result from server.
Finalize
deviceFingerprint?.release()