DwnProfilingSDK

class DwnProfilingSDK(appActivity: Activity)

Version: 1.14.35

Example
class MainActivity : AppCompatActivity() {

private var dwnProfiling: DwnProfilingSDK? = null

fun dwnApiCall(fp: String) {
// Send a https request to darwinium API server, pass profiling data within
}

override fun onCreate(savedInstanceState: Bundle?) {
val config = hashMapOf(
"https_profiling_domain" to "profiling-dev.int.darwinium.io",
"dns_domain" to "dnsdev.pub.darwinium.io",
)
dwnProfiling = DwnProfilingSDK(this)
dwnProfiling.start(config)

// Clients can ask user's permissions by using darwinium provided method
// Or clients can only request their preferable permissions
dwnProfiling.requestPermissions()

// apply darwinium keyboard biometrics on input fileds
val username = this.findViewById<TextView>(R.id.username)
// Note:
// addTextView() is a class static function, not a instance method,
// can be called from different activities/views
DwnProfilingSDK.addTextView(username, "USER_NAME")
// You can also use binding to locate textview
DwnProfilingSDK.addTextView(binding.password, "PASSWORD")


// Two methods to collect profiling data
// 1. set listener when [LOGIN] button clicked
login.setOnClickListener {
// stop profiling before collect the information
dwnProfiling.stop()
val fp = dwnProfiling.collect()
dwnApiCall(fp)
}

// 2. async collect with callback
dwnProfiling.collectAsync(::dwnApiCall)
...
}

Be aware, the following libraries not add as dependencies for darwinium SDK, if you want to detection location or advertising_id, need add the followings in app build.grade

implementation 'com.google.android.gms:play-services-location:21.0.1'
implementation 'com.google.android.gms:play-services-ads-lite:20.3.0'

Parameters

appActivity

Activity - An activity that you wish to bind to - typically you would use this and instigate within your current view

Constructors

Link copied to clipboard
constructor(appActivity: Activity)

constructor Creates a new Darwinium profiling instance. The Darwinium Profiling SDK is used to provide risk assessment based on device and behavioral biometric intelligence.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun addTextView(textView: TextView, keyContext: String)
Link copied to clipboard

Synchronous method used to collect profiling information, which is then sent in a subsequent web request.
It is recommended that you provide this in a header, 'Dwn-Profiling', if using the edge, however if not using the edge you may attach it through any means necessary and provide it in your backend call.
As profiling may not have completed at the time of call, it is typically recommended that you use collectAsync.
collect() is intended to be called after start() has been invoked, and no content will be returned if it has not.

Link copied to clipboard
fun collectAsync(callback: (String) -> Unit, timeout: Long = 15000)

Asynchronous method used to collect profiling information and callback function to process the profiling data

Link copied to clipboard
fun done(): Boolean

Denotes whether profiling has been completed.
If using synchronous methods, this should be checked prior to using collect()

Link copied to clipboard
fun processPermissions(requestCode: Int, grantResults: IntArray)

Used when permissions are provided by the activity.
This informs Darwinium of the permissions that have been made available to it.
You would typically call this in your activity’s onRequestPermissionsResult method.

Link copied to clipboard

Requests appropriate permissions, * such as geolocation or telephony needed to collect necessary profiling.
Note that this relies on <uses-permission> entries in your AndroidManifest.xml.
If they are not present, this will not be captured as part of the profiling performed.
Refer to The SDK installation guide for more details see also: processPermissions

Link copied to clipboard
fun start(config: HashMap<String, Any>? = null)

Starts profiling. The config object is optional and may either be specified

Link copied to clipboard
fun stop()

Stops profiling.
Depending on the content of your activity you may wish to use start and stop on multiple successive occasions such that your profiling blob.
biometrics is relevant to the user action being performed.