{"action":"created","issue":{"url":"https://api.github.com/repos/nordnet/cordova-hot-code-push/issues/72","labels_url":"https://api.github.com/repos/nordnet/cordova-hot-code-push/issues/72/labels{/name}","comments_url":"https://api.github.com/repos/nordnet/cordova-hot-code-push/issues/72/comments","events_url":"https://api.github.com/repos/nordnet/cordova-hot-code-push/issues/72/events","html_url":"https://github.com/nordnet/cordova-hot-code-push/issues/72","id":122832965,"number":72,"title":"Android: First run (right after install) seems to ignore auto-download and auto-install","user":{"login":"mauron85","id":359450,"avatar_url":"https://avatars.githubusercontent.com/u/359450?v=3","gravatar_id":"","url":"https://api.github.com/users/mauron85","html_url":"https://github.com/mauron85","followers_url":"https://api.github.com/users/mauron85/followers","following_url":"https://api.github.com/users/mauron85/following{/other_user}","gists_url":"https://api.github.com/users/mauron85/gists{/gist_id}","starred_url":"https://api.github.com/users/mauron85/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mauron85/subscriptions","organizations_url":"https://api.github.com/users/mauron85/orgs","repos_url":"https://api.github.com/users/mauron85/repos","events_url":"https://api.github.com/users/mauron85/events{/privacy}","received_events_url":"https://api.github.com/users/mauron85/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nordnet/cordova-hot-code-push/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/nordnet/cordova-hot-code-push/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-17T22:07:30Z","updated_at":"2015-12-18T09:45:12Z","closed_at":null,"body":"Hi, I've disabled auto-install and auto-download in config.xml.\r\nBut it seems to be ignored on first run (right after install).\r\n\r\nApp get stuck on update, and it has to be closed and reopened. On second and all others run, everything is fine.\r\n\r\nI have preloader index.html page, which sets things up and redirects to an app.html page.\r\nSo basically I'm listening on deviceready event and do chcp update checks.\r\n\r\nIn my app, I was expecting console logs to be in following order:\r\n1. Device is ready\r\n2. Plugin configured successfully\r\n3. update is ready\r\n\r\nBut actually on first run I see:\r\n1. Device is ready\r\n2. update is ready\r\n\r\n\r\n```\r\n   function onUpdateReady () {\r\n      console.log('update is ready');\r\n      //this should be called only after chcp.fetchUpdate(fetchUpdateCallback);\r\n   }\r\n\r\n    function onDeviceReady () {\r\n        console.log('Device is ready');\r\n        var options = {\r\n          'auto-download': false,\r\n          'auto-install': false\r\n        };\r\n\r\n        chcp.configure(options, configureCallback);\r\n    }\r\n    function configureCallback (error) {\r\n        if (error) {\r\n          console.log('Error during the configuration process');\r\n          console.log(error.description);\r\n          init();\r\n        } else {\r\n          console.log('Plugin configured successfully');\r\n          // from this moment only we control when to download and install new releases\r\n          chcp.fetchUpdate(fetchUpdateCallback);\r\n        }\r\n    }\r\n\r\n    function fetchUpdateCallback (error, data) {\r\n        if (error) {\r\n            console.log('Failed to load the update with error code: ' + error.code);\r\n            console.log(error.description);\r\n            init();\r\n            return;\r\n        } else {\r\n            console.log('Update is loaded, running the installation');\r\n            chcp.installUpdate(installationCallback);\r\n        }\r\n    }\r\n\r\n    function installationCallback (error) {\r\n        if (error) {\r\n            console.log('Failed to install the update with error code: ' + error.code);\r\n            console.log(error.description);\r\n        } else {\r\n            console.log('Update installed!');\r\n        }\r\n        init();\r\n    }\r\n\r\n    function init () {\r\n        window.document.location = 'mobile.html';\r\n    }\r\n\r\n    document.addEventListener('deviceready', onDeviceReady, false);\r\n    document.addEventListener('chcp_updateIsReadyToInstall', onUpdateReady, false);\r\n```"},"comment":{"url":"https://api.github.com/repos/nordnet/cordova-hot-code-push/issues/comments/165731765","html_url":"https://github.com/nordnet/cordova-hot-code-push/issues/72#issuecomment-165731765","issue_url":"https://api.github.com/repos/nordnet/cordova-hot-code-push/issues/72","id":165731765,"user":{"login":"nikDemyankov","id":13447778,"avatar_url":"https://avatars.githubusercontent.com/u/13447778?v=3","gravatar_id":"","url":"https://api.github.com/users/nikDemyankov","html_url":"https://github.com/nikDemyankov","followers_url":"https://api.github.com/users/nikDemyankov/followers","following_url":"https://api.github.com/users/nikDemyankov/following{/other_user}","gists_url":"https://api.github.com/users/nikDemyankov/gists{/gist_id}","starred_url":"https://api.github.com/users/nikDemyankov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikDemyankov/subscriptions","organizations_url":"https://api.github.com/users/nikDemyankov/orgs","repos_url":"https://api.github.com/users/nikDemyankov/repos","events_url":"https://api.github.com/users/nikDemyankov/events{/privacy}","received_events_url":"https://api.github.com/users/nikDemyankov/received_events","type":"User","site_admin":false},"created_at":"2015-12-18T09:45:11Z","updated_at":"2015-12-18T09:45:11Z","body":"Thanks, will check it."}}