android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running? in react-native android
I want to show a custom view when the app is turned off or when the app is turned on, depending on the phone state.
so I use WindowManager. but get error message
W/System.err: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
W/System.err: at android.view.ViewRootImpl.setView(ViewRootImpl.java:1596)
W/System.err: at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:509)
W/System.err: at...