DwnProfilingSDK

class DwnProfilingSDK(appActivity: Activity? = null)

Version: 2.2.0

Example
// import Darwinium SDK into app
import com.darwinium.dwn_sdk.DwnProfilingSDK

The Darwinium SDK supports multiple profiling instances, which means you can create an instance based on Activities/Views
In each Activity you want to profiling, e.g. Login Activity/View, Payment Activity/View,
* Inside onCreate() method: create an sdk instance, sdk = DwnProfilingSDK()
* Where biometrics are needed for particular form text fields, use `addTextField()`
* Inside onDestroy() method: stop Darwinium's profiling, e.g.

class MyActivity : AppCompatActivity() {

private var sdk: 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(
"profiling_debug": true
)
sdk = DwnProfilingSDK()
sdk.start(config, this)

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

// apply darwinium keyboard biometrics on input fileds
val username = this.findViewById<TextView>(R.id.username)
sdk.addTextView(username, "USER_NAME")

// There are two possible methods to collect profiling data
// 1. set listener when [LOGIN] button clicked
// This is the preferred method, the client can call it after all biometric data has been collected
// e.g. key inputs, touch movements data
loginButton.setOnClickListener {
// stop profiling before collect the information
val fp = sdk.collect()
yourApiCall(fp)
}

// 2. async collect with callback
// This method will be triggered asynchronously and may result in incomplete biometric data
// e.g. may not collect key inputs and touch movement data
dwnProfiling.collectAsync(::dwnApiCall)
...
}

// stop SDK when activity destroyed
override fun onDestroy() {
sdk.stop()
}
}

NOTES
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

optional, Activity - An activity that you wish to bind to - typically you would use this and instigate within your current view. - If you wrap sdk in a object() which doesn't know the activity during wrapper constructor, you can pass the activity in start

Constructors

Link copied to clipboard
constructor(appActivity: Activity? = null)

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
Link copied to clipboard

Properties

Link copied to clipboard
val mutex: <Error class: unknown class>
Link copied to clipboard

Functions

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

Registers a text view for behavioral biometrics profiling.
Text views can provide valuable insights into typing behavior and whether facilities like copy-paste have been used.

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.
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
Note: collect() wouldn't wait for some biometrics data, e.g. key inputs and touch movements data
if you want collect enough data on key inputs, touch movements and wait for permission gave by the user
It's better to call collect() after enough time for the permissions and human interactions

Link copied to clipboard
fun done(): Boolean

Indicates whether profiling for deterministic features has been completed.
Excludes continuous operations such as biometric data collection.

Link copied to clipboard
fun onFocusChange(focus: Boolean, keyContext: String)

This is for situations where text input is not handled through a standard Android UI Text component. This includes: Jetpack Compose React Native Onscreen Keyboards Where input is handled through a standard text field, this should not be used. Normally work with onTextChange on Jetpack Compose or onKeyPress on React Native App

Link copied to clipboard
fun onKeyPress(keyValue: String, keyContext: String)

This is for situations where text input is not handled through a standard Android UI Text component. This includes: Jetpack Compose React Native Onscreen Keyboards Where input is handled through a standard text field, this should not be used. This is specially react native app, if you are NOT using react native app, just ignore it Normally work with onFocusChange

Link copied to clipboard
fun onTextChange(value: String, keyContext: String)

This is for situations where text input is not handled through a standard Android UI Text component. This includes: Jetpack Compose React Native Onscreen Keyboards Where input is handled through a standard text field, this should not be used. Normally work with onFocusChange

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
fun requestPermissions(activity: Activity? = null)

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: <Error class: unknown class><String, Any>? = null, activity: Activity? = null)

Starts profiling.
You can call start() in activity onCreate() and pass the activity as parameter

Link copied to clipboard
fun stop()

Stops profiling.
You can call stop() in activity onDestroy()

Link copied to clipboard
fun stopTextView(keyContext: String)

Stop a text view for behavioral biometrics profiling.
This will stop one textView which was added with "keyContext"