repositories {
...
mavenCentral()
maven { url 'https://mvnrepository.com/artifact/ai.gosense/android' }
maven { url 'https://jitpack.io' }
}dependencies {
implementation 'ai.gosense:device-security:0.0.7'
}import ai.gosense.devicesecurity.Sense
import ai.gosense.devicesecurity.SenseConfigval config = SenseConfig(
apiKey = "your API Key",
senseInfo = false, // true or false
allowGeoLocation = true, //true or false
tag = "YOUR_TAG",
// senseConfig.metaInfo = [
// "phone": "9xxxxxxxxx",
// "name": "xxxxxxxxxxx"
// ]
// A collection of key-value pairs intended for storing supplementary data
// related to the request. The set supports up to 15 pairs, with each
// key and value limited to a maximum of 256 characters.
)
Sense.initSDK(activity, config)Sense.getSenseDetails(this)Sense.getSenseDetails(object : Sense.SenseListener {
override fun onSuccess(data: String) {
// success callback
}
override fun onFailure(message: String) {
// failure callback
}
})<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"
tools:ignore="ProtectedPermissions"/>-keep,allowobfuscation,allowshrinking interface retrofit2.Call
-keep,allowobfuscation,allowshrinking class retrofit2.Response
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.** { *; }
-dontwarn ai.gosense.**
-keep class ai.gosense.** {*;}import ai.gosense.devicesecurity.Sense
import ai.gosense.devicesecurity.SenseConfig
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val config = SenseConfig(
apiKey = "your API Key",
senseInfo = false, // true or false
allowGeoLocation = true, //true or false
tag = "YOUR_TAG",
// senseConfig.metaInfo = [
// "phone": "9xxxxxxxxx",
// "name": "xxxxxxxxxxx"
// ]
// A collection of key-value pairs intended for storing supplementary data related to the
// request. The set supports up to 15 pairs, with each key and value
// limited to a maximum of 256 characters.
)
//Initialize SDK
Sense.initSDK(this, config)
// Fetch device details
getSenseDetails();
}
private fun getSenseDetails() {
Sense.getSenseDetails(object : Sense.SenseListener {
override fun onSuccess(data: String) {
// Handle success callback
}
override fun onFailure(message: String) {
// Handle failure callback
}
})
}
}