Dwn Profiling SDK
Version: 1.14.35
Exampleclass 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
Activity - An activity that you wish to bind to - typically you would use this and instigate within your current view
Constructors
Functions
Deprecated, replaced by DwnProfilingSDK.Companion.addTextView
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.
Asynchronous method used to collect profiling information and callback function to process the profiling data
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.
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