Instabug-Android
Instabug-Android copied to clipboard
App restart required to apply Instabug InvocationEvents
Steps to Reproduce the Problem
Enable:
- Enable Instabug with
InvocationEvents-->InstabugInvocationEvent.SHAKE, InstabugInvocationEvent.SCREENSHOT - and shake the device without restarting the device and observe bug-report pop-up won't show
- shake the device after restarting the app bug-report pop-up will show.
Disable
- Disable Instabug with
InvocationEvents-->InstabugInvocationEvent.NONE - shake the device without restarting the app, a bug report pop-up will show.
- and shake the device after restarting the device and observe bug-report pop-up won't show
Expected Behavior
- Changes should apply without restarting the app.
Actual Behavior
- App restart is required to apply Instabug InvocationEvents
Instabug integration code
package com.test.instabugtest
import android.app.Application
import android.content.Context
import android.content.SharedPreferences
import androidx.core.content.edit
import com.instabug.library.Instabug
import com.instabug.library.invocation.InstabugInvocationEvent
const val KEY_INSTABUG = "Instabug"
class InstabugConfig(
private val context: Application,
) {
private val sharedPreferences: SharedPreferences =
context.getSharedPreferences(this::class.java.simpleName, Context.MODE_PRIVATE)
var isEnabled
set(value) {
sharedPreferences.edit {
putBoolean(KEY_INSTABUG, value).commit()
}
}
get() = sharedPreferences.getBoolean(KEY_INSTABUG, false)
fun enable(enable: Boolean) {
val invocationEvent = if (enable) {
InstabugInvocationEvent.SHAKE
} else {
InstabugInvocationEvent.NONE
}
Instabug.Builder(context, context.getString(R.string.instabug_beta_id))
.setInvocationEvents(invocationEvent)
.build()
isEnabled = enable
}
}
//Activity
val config = InstabugConfig(this.application)
buttonEnable.setOnClickListener {
config?.enable( true)
}
buttonDisable.setOnClickListener {
config?.enable( false)
}
SDK Version
implementation 'com.instabug.library:instabug:11.5.1'
Android Version
android {
compileSdk 32
defaultConfig {
applicationId "com.test.instabugtest"
minSdk 23
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
......
}
Device Model
Samsung S21 Ultra (Android 12)