Skip to main content

Description

This version of 'audit' @ Cloudsmith

Trust Audit is an SDK in charge of registering events or customized audits, obtaining data from the moment that is required to persist.

Implementation#

To do add the following, at any location, to your build.gradle (project level) file:

repositories {
maven {
url "https://dl.cloudsmith.io/FS8nndyEGXuONddI/trusttechnologies/auditv2/maven/"
}
}

and add the implementation to your build.gradle (app level) file:

dependencies {
implementation 'com.sdk.audit:audit:0.0.18'
}

Initialize#

In your file that extends "Application()" within the "onCreate()" method you must initialize the SDK

class App : Application() {
override fun onCreate() {
super.onCreate()
TrustAudit.Builder().init(this).build()
}
}

Permissions (optional)#

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:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

Note: These permissions are optional, if they are not granted, the audits will be sent without a location from where they were issued.

Methods#

This section describes the methods that the library has.

Send Audit#

Object#

The Transaction object is necessary to create an audit, this object contains the precise data to be sent.

Operation: Consists of the name of the operation, such as : Login audit; buy audit

Method: Refers to the name of the method that generated the audit, such as: onSuccessLogin()

Result: Data to be stored, such as: "Success Login", "Failure Login", etc.

Object: Some object that is required to be stored, such as User data or others.

- Case 1#

TrustAudit.sendAudit(Transaction("method","operation","result"))

- Case 2#

TrustAudit.sendAudit(Transaction("method","operation","result","object"))

- Case 3#

TrustAudit.sendAudit(transaction,context,object : AuditListener<AuditResponse> {
override fun onFailure(code: Int, msg: String) {
Log.d("log",msg) //message
}
override fun onSuccess(data: AuditResponse?) {
data.audit.auditId //audit id
}
})

Save Indentity#

If it is necessary to send user data, such as name, surname, ID, etc, they can be saved using the saveIndentity method. once the user data is stored, the next audits will include this user data

Object#

The Identity object stores basic user data such as

Name: username

Lastname: user's last name

Email: user email

Dni: unique identifier of the user

- Case#

TrustAudit.saveIndentity(Identity("Jhon","Doe","jdoe@example.com","199902"))
Last updated on by fcaro