Open sealover06 opened 5 years ago
Hi @sealover06 I also use both those plugins in an app, on Android 6.0. I have seen that it is necessary to disable temporarily the kiosk mode to let the plugin-app-update do its work (stop, update, restart). The risk is that the user could be asked to confirm again that the app must be in kiosk mode (primary launch application). Another way could be to force stopping the app, so the update can proceed. It happend to me that the callback event after app-update does not work, so I added a timeout to force stopping the app one minute after finding out that the app needs update.
Thank you so much @carlo318, let me test this asap. Stay tuned !
Well, I'm not sure that I can deal with cordova-plugin-kiosk. the KioskPlugin.exitKiosk() function leads to a popup "Select destination Launcher3 / myApp" I'm looking for full automation here with no user click...
@vaenow, please any thoughts on the compatibility of your great app-update plugin with a kiosk plugin ? thank you so much in advance.
@carlo318, may you share your code for "a timeout to force stopping the app one minute after finding out that the app needs update" ? thank you !
@sealover06 this is my example code, forcing Exit App and Stop Kiosk mode after 30sec:
var updateUrl = "https://myserver.com/version.xml"; // Get xml from server $http.get(updateUrl, {}).success(function(xmlData, status) { // Check if App needs update by reading xml info if ($(xmlData).find('version').text() > window.localStorage['appVersionCode']) { // New version available: try to update window.AppUpdate.checkAppUpdate(function(result) { // Success }, function(err) { // Fail window.localStorage["Reboot"]="0"; }, updateUrl, { 'skipPromptDialog' : true, 'skipProgressDialog' : true }); $rootScope.NeedUpdate = true; // After 30 seconds disable Kiosk and Close App to allow autoUpdate $timeout(function() { Kiosk.setKioskEnabled(false); navigator.app.exitApp(); }, 30000); window.localStorage["Reboot"]="1"; //Reboot at next App start } else { // App is up-to-date console.log('App is Up-to-date'); } }).error(function(data, status, headers, config) { console.log('CheckAppUpdate XML err: '+ data); });
It only work with "mild" kiosk mode: cordova-plugin-kiosk-launcher
Hope it helps.
Hello Vaenow and team. Let me start: this plugin is awesome. Works like a charm.
I can just see 1 issue when run as well with the kiosk plugin. and this case and only this case, I get a Download Again / Install Manually popup that is stuck on the screen.
From similar issues, I've seen that a way to fix this was to add
uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" in the AndroidManifest.xml
But I've checked, and yes, I have already this line...
uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"
uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
uses-permission android:name="android.permission.REORDER_TASKS"
uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"
Omitted the tags since interpreted by the editor.
My Tablet runs android 6.0.1
Thanks for help, I really need both plugin to work together. Thanks a lot in advance, Cheers, Denys