Kotlin Unable to add window -- token null is not valid; is your activity running?
I am getting the error Unable to add window -- token null is not valid; is your activity running?.
From my Main activity am calling the floating window service like this as below.
startService(Intent(this, FloatingWindow::class.java))
I have set the permission on manifest as below.
and here is my FloatingWindow class
class FloatingWindow : Service() {
var wm: WindowManager? = null
var ll: LinearLayout? = null
override fun onBind(intent: Intent?): IBinder? {
//...