thaarok / cordova-plugin-kiosk

Cordova plugin to use Cordova application "in kiosk mode" and as Android launcher
Apache License 2.0
142 stars 101 forks source link

Not Working After shutdown or restart #62

Open profitable opened 6 years ago

profitable commented 6 years ago

Everything works correctly before restarting or shutting down the phone. When I restart the phone or shutdown and turn on again, it shows me a dialog which asks me to "Select a Home app" and shows two options "Huawei Home" & "CordovaKioskDemo", when I choose "Huawei Home" it works, but which I choose "CordovaKioskDemo" it shows a black screen and then asks me again to "Select a Home app" and keeps on doing the same. So if I choose "Huawei Home" and go to settings I can see that the Default Home App is set to "none", although I have set it before to "CordovaKioskDemo". And if I set it again to "CordovaKioskDemo" and open "CordovaKioskDemo", it shows a black screen and close the app. Could you please help me figure out the issue. I am testing it on HUAWEI Y5 Prime 2018 Android 8.1.0 if that helps. BTW, it works properly on Android version 5.0.1 on GT-I9500 samsung device.

thaarok commented 6 years ago

Does Chrome debugging show some error message? ( https://developer.chrome.com/devtools/docs/remote-debugging ) Does Logcat show some useful error message? ( $ANDROID_HOME/platform-tools/adb logcat )

profitable commented 6 years ago

Hello, Chrome debugging is not showing anything. Logcat shows the following:

09-04 13:07:24.825 24007 24007 D AndroidRuntime: Shutting down VM
09-04 13:07:24.835 24007 24007 E AndroidRuntime: FATAL EXCEPTION: main
09-04 13:07:24.835 24007 24007 E AndroidRuntime: Process: pk.capripio.backgroundtasks, PID: 24007
09-04 13:07:24.835 24007 24007 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{pk.capripio.backgroundtasks/jk.cordova.plugin.kiosk.KioskActivity}: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@b94dc9d -- permission denied for window type 2010

I tried adding permission for android.permission.SYSTEM_ALERT_WINDOW, but it's still the same, any clue?

profitable commented 6 years ago

I am using version 2.0 now https://github.com/hkalina/cordova-plugin-kiosk/tree/v2.0 which seems to work unlike the latest version.