READ_PHONE_STATE Permission in Android Manifest for device information (Optional).dependencies {
implementation 'ai.gosense:devicesecurity:1.0.4'
}import ai.gosense.devicesecurity.Sense
import ai.gosense.devicesecurity.SenseConfigSense.prewarm() is internal now. initSDK() calls it automatically.val config = SenseConfig(
apiKey = "Your API Key",
senseInfo = true, // true or false
allowGeoLocation = true, // true or false
tag = ""// Whatever you need, just mention the string here like home, contact, etc.
)
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
}
})SenseRaspListener on your Activity or Fragment host.READ_PHONE_STATE is optional and is used only for call/SIM-related signals. Do not request READ_PRIVILEGED_PHONE_STATE: it is reserved for privileged system apps and is never granted to ordinary Play-distributed apps.<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" />-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
import ai.gosense.devicesecurity.SenseRaspListener
class MainActivity : AppCompatActivity(), SenseRaspListener {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val config = SenseConfig(
apiKey = "Your API Key", //Replace with your Client Public API Key
senseInfo = true, // true or false
allowGeoLocation = true, // true or false
tag = ""// Whatever you need, just mention the string here like home, contact, etc.
)
// Initialize SDK. prewarm() is handled internally.
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
}
})
}
override fun onAppIntegrityThreatDetected(isOn: Boolean) {
// Handle clone / tamper alert
}
}