Firebase Crashlytics reported one device (Xiaomi Redmi 4X, Android 7.1.2) with error at (I can't reproduce this issue on my own devices)
fun show() {
if (Settings.canDrawOverlays(context) {
windowManager.addView(floatView, layoutParams)
}
}
Caused by android.view.WindowManager$BadTokenException Unable to add window -- token null is not valid; is your activity running?
override fun onStop() {
super.onStop()
if (prefsManager.isShowOverlay()) {
floatingWindow.show()
}
}
My apps shows the floating window when activity stops (Activity.onStop()), here's logs from crashlytics:
p.s. please don't reference here similar questions but for AlertDialog and PopupWindow, it's a different issue!
