Skip to content
This repository was archived by the owner on Oct 1, 2018. It is now read-only.
This repository was archived by the owner on Oct 1, 2018. It is now read-only.

Android: First run (right after install) seems to ignore auto-download and auto-install #72

@mauron85

Description

@mauron85

Hi, I've disabled auto-install and auto-download in config.xml.
But it seems to be ignored on first run (right after install).

App get stuck on update, and it has to be closed and reopened. On second and all others run, everything is fine.

I have preloader index.html page, which sets things up and redirects to an app.html page.
So basically I'm listening on deviceready event and do chcp update checks.

In my app, I was expecting console logs to be in following order:

  1. Device is ready
  2. Plugin configured successfully
  3. update is ready

But actually on first run I see:

  1. Device is ready
  2. update is ready
   function onUpdateReady () {
      console.log('update is ready');
      //this should be called only after chcp.fetchUpdate(fetchUpdateCallback);
   }

    function onDeviceReady () {
        console.log('Device is ready');
        var options = {
          'auto-download': false,
          'auto-install': false
        };

        chcp.configure(options, configureCallback);
    }
    function configureCallback (error) {
        if (error) {
          console.log('Error during the configuration process');
          console.log(error.description);
          init();
        } else {
          console.log('Plugin configured successfully');
          // from this moment only we control when to download and install new releases
          chcp.fetchUpdate(fetchUpdateCallback);
        }
    }

    function fetchUpdateCallback (error, data) {
        if (error) {
            console.log('Failed to load the update with error code: ' + error.code);
            console.log(error.description);
            init();
            return;
        } else {
            console.log('Update is loaded, running the installation');
            chcp.installUpdate(installationCallback);
        }
    }

    function installationCallback (error) {
        if (error) {
            console.log('Failed to install the update with error code: ' + error.code);
            console.log(error.description);
        } else {
            console.log('Update installed!');
        }
        init();
    }

    function init () {
        window.document.location = 'mobile.html';
    }

    document.addEventListener('deviceready', onDeviceReady, false);
    document.addEventListener('chcp_updateIsReadyToInstall', onUpdateReady, false);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions