Code Monkey home page Code Monkey logo

Comments (4)

carlo318 avatar carlo318 commented on August 10, 2024

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.

from cordova-plugin-app-update.

sealover06 avatar sealover06 commented on August 10, 2024

from cordova-plugin-app-update.

sealover06 avatar sealover06 commented on August 10, 2024

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 !

from cordova-plugin-app-update.

carlo318 avatar carlo318 commented on August 10, 2024

@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.

from cordova-plugin-app-update.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.