Description
Trust ID is a SDK in charge of providing a unique id per device or, failing that, per application installation
Implementation
To do add the following, at any location, to your build.gradle (project level) file:
repositories {
maven { url "https://dl.cloudsmith.io/m7836dd9LUcQSmg1/trusttechnologies/identifyv2/maven/"}
}
and add the implementation to your build.gradle (app level) file:
dependencies {
implementation 'com.sdk.trust.identify:identify:0.0.12'
}
Initialize
In your file that extends "Application()" within the "onCreate()" method you must initialize the SDK, giving a context and credentials.
class App : Application() {
override fun onCreate() {
super.onCreate()
val credentials = TrustCredentials(<YOU_CLIENT_ID>,<YOU_CLIENT_SECRET>)
Trust.Builder()
.init(this)
.setCredentials(trustCredentials)
.build()
}
}
Supports API
Api | Version | NAme |
---|---|---|
31 | Android 12 | - |
30 | Android 11 | - |
29 | Android 10 | - |
28 | Android 9.0 | Pie |
27 | Android 8.1 | Oreo |
26 | Android 8.0 | Oreo |
25 | Android 7.1 | Nougat |
24 | Android 7.0 | Nougat |
23 | Android 6.0 | Marshmallow |
22 | Android 5.1 | Lollipop |
21 | Android 5.0 | Lollipop |
20 | Android 4.4W | KitKat |
19 | Android 4.4 | KitKat |
Permissions
In order for the library to work without problems, the following permissions must be added to the application. Remember: This permissions are granted from user directly, additionally to write at manifest:
Trust identify normal permission from API29 or higher
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
Trust identify normal permission from API29 or lower
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Note 1: if storage permissions are not granted, the SDK will return a trust id per application instead of per device.
Note 2: if hardware read permission is not granted, the SDK will return a trust id per application instead of per device.
Methods
This section describes the methods that the library has.
Get Trust ID
Trust.getTrustId(object : TrustListener<TrustDataResponse> {
override fun onSuccess(code: Int, trustData: TrustDataResponse) {
//code : the code response from API
//trustData: contains the trust id
}
override fun onError(code: Int, msg: String) {
//code : the code response from API
//msg: the error message from API
}
})
Set Identify
Save a identify to be sended
Trust.setIdentify(TrustIdentity)
Send Identify
Send the identify
Trust.sendIdentify(TrustIdentity?)
Delete Identify
Delete the saved identify
Trust.deleteIdentity()
Save Device Info
Assign a trust id to a user DNI and bundle id
Trust.saveDeviceInfo(dni)
Assign a trust id to a firebase token and bundle id
Trust.registerDevice(firebaseToken,bundleId?)
Assign a trust id to a user DNI and bundle id
Trust.registerCompanyState(bundleId, dni?)