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

overwrite MainActivity configuration #40

Closed odai-alali closed 6 years ago

odai-alali commented 6 years ago

KioskActivity should overwrite the MainActivity configuration in manifest file, otherwise two the built application will contain two cordova activities and only the KioskActivity will be visible.

This error can be seen in the device inspect in Chrome: image

thaarok commented 6 years ago

Hi, this change is already included in experimentail branch "mainactivity" - see https://github.com/hkalina/cordova-plugin-kiosk/issues/27 This is not merged in upstream yet, because of problem reported by @narigondelsiglo. Please test this branch and let us know if it works ok - if it will work ok for you, I will merge it and also modification requested in this PR will be in master.

odai-alali commented 6 years ago

OK, I'll check it tomorrow. But I noticed that you deleted HomeActivity.java. Isn't needed as the comment in plugin.xml states?

activity to use as launcher - because Cordova app is failing if started while boot

thaarok commented 6 years ago

That is related to very old Android versions. But please test and let us know if device reboot correctly while kiosk app is set as launcher activity.

odai-alali commented 6 years ago

cordova-android:7.0 android device 5.0

So... I installed the mainactivity branch to check it out.

The kiosk mode runs without problems. On reboot the home screen chooser appears with my app in the list waiting for the user to choose (setting the app as the default user screen should eliminate this).

But I noticed weird behavior, The back button is not blocked completely. it triggers the history back in my web application but exiting the application with back button in prevented though. Is that an expected behavior?

Hope this helps.

thaarok commented 6 years ago

@odai-alali to allow Back button (or volume buttons for example) use KioskPlugin.setAllowedKeys([ keyCode ]); call. Thanks for confirmation, will merge mainactivity into master now.

thaarok commented 6 years ago

Just note there is also build failure in CI for this PR:

node:5612) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Unable to graft xml at selector "/manifest/application/activity[@android:name='MainActivity']" from "/home/travis/build/hkalina/cordova-plugin-kiosk/hello/platforms/android/app/src/main/AndroidManifest.xml" during config install

thaarok commented 6 years ago

Thanks! Everything is in master now.