Skip to main content

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

ApiVersionNAme
31Android 12-
30Android 11-
29Android 10-
28Android 9.0Pie
27Android 8.1Oreo
26Android 8.0Oreo
25Android 7.1Nougat
24Android 7.0Nougat
23Android 6.0Marshmallow
22Android 5.1Lollipop
21Android 5.0Lollipop
20Android 4.4WKitKat
19Android 4.4KitKat

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?)