Cordova Hot Code Push Plugin
This plugin provides the ability to enable the Cordova app to automatically update Web content. Basically, all the files in your app that are in the WWW directory can be automatically updated.
When you re-publish the new app-repackage the Web content: HTML files, JavaScript code, pictures, and so on. There are generally two ways to upgrade:
The new app is on the shelves in AppStore. But it takes a long time.
At the expense of all native features, each opening is loaded from the remote site. But without the internet, apps can't be used.
This plugin was born to solve this problem. When a user opens the app for the first time-it copies all Web content to an external store. The Web content is then loaded from external storage without loading the Web content packaged inside the app. Each time the app starts, it will connect to the server to check for updates and download new Web content. If an update is downloaded-This update will take effect the next time the app is launched.
In this way, your app is updated in real time and can be used offline. Also, plugins allow you to set the minimum supported app shell version of your Web content to ensure that new Web content runs on the old app shell.
Can the App store have this app on the shelves? OK... As long as your updated Web content conforms to the app's first function. If it was a calculator, the update turned into a music player-it would be banned. Support Platform
Android 4.0.0 or above.
IOS 7.0 or above. Document
Installation
Migrating from a low version
Cordova Project Quick Guide
Ionic Project Quick Guide
Flowchart of the update mechanism
How Web content is stored and updated
Cordova Hot Code Push command-line Client
Local Development Extensions
Cordova Configuration Items
Configuration file
Application Config App configuration
Content Manifest Contents List
Build Options Build Settings
JavaScript Module
Listen for updated events
Request an update
Install updates
Change plugin settings at run time
Request to update app (shell) from store
Error code installation
Need Cordova 5.0+
Cordova Plugin Add Cordova-hot-code-push-plugin
can also be installed directly from the warehouse URL (unstable)
Cordova Plugin Add Https://github.com/nordnet/cordova-hot-code-push.git
After the plugin is installed, you will be recommended to install the Cordova Hot Code Push command line client. This customer can help you:
Easy to generate the necessary app configuration files;
Start the local server, listen for Web content changes in development mode, and deploy the new version directly.
Of course, you can also use this command-line client, just using it will be more convenient. migrating from a low version from v1.0.x to v1.1.x
In version 1.0.x, the local development model was integrated into the plugin. Starting with v1.1.x This part of the feature is an extension of this plugin, moved here. Because the v1.0 version has done some optimizations for iOS-enabled Swift-upgrade to v1.1.x you need to disable it.
Ways to reinstall IOS Platform:
Cordova Platform Remove iOS
Cordova Platform add iOS
When platform is added-all plugins are automatically installed.
Advanced-Manual removal of Swift support. You need to open the IOS project with Xcode and then:
In Build Settings, set Embedded Content Contains Swift Code to NO.
Open <your_project_name>-prefix.pch and remove #import <your_project_name>-swift.h. Like what:
#ifdef __objc__
#import "testproject-swift.h"
#endif
Re-build to check for normal. Cordova Project Quick Guide
This wizard shows you how to use this plugin quickly in development. We need to add a development extension that requires Xcode 7, although the hot code push plugin plugin itself can support the low version of Xcode.
Create a new Cordova project and add Android and iOS platform:
Cordova Create TestProject com.example.testproject testprojectcd./testproject
Cordova Platform add Android
Cordova Platform Add iOS
Or you can use an existing project.
Add Plugins:
Cordova Plugin Add Cordova-hot-code-push-plugin
To add a development extension:
Cordova Plugin Add Cordova-hot-code-push-local-dev-addon
Install the Cordova hot Code Push command line client:
NPM install-g CORDOVA-HOT-CODE-PUSH-CLI
To start the local server:
CORDOVA-HCP Server
You will see the following command line output:
Running server
Checking: /cordova/testproject/www
local_url http://localhost:31284
Warning:. Chcpignore does not exist.
Build 2015.09.02-10.17.48 created in/cordova/testproject/www
cordova-hcp local server available at:http:// localhost:31284
cordova-hcp Public server available at:https://5027caf9.ngrok.com
Open a new console, go to the project root directory, run the app:
Cordova Run
Wait, the app will be installed on the phone or simulator.
Now open testproject/www/index.html, make some changes and save. After a few seconds you can see the updated page on your phone or simulator.
Here, you can develop it locally and the new Web content will be automatically updated on the device without restarting the app to see the effect. Ionic Project Quick Guide
This wizard shows you how to use this plugin quickly in development. We need to add a development extension that requires Xcode 7, although the hot code push plugin plugin itself can support the low version of Xcode.
Create a new Ionic project and add Android and iOS platform::
Ionic start TestProject blankcd./testproject
Ionic Platform add Android
Ionic Platform add iOS
Or use the existing one.
Add Plugins:
Ionic plugin Add Cordova-hot-code-push-plugin
To add a development extension:
Ionic plugin Add Cordova-hot-code-push-local-dev-addon
Install the Cordova hot Code Push command line client:
NPM install-g CORDOVA-HOT-CODE-PUSH-CLI
To start the local server:
CORDOVA-HCP Server
You will see the following command line output:
Running server
Checking: /cordova/testproject/www
local_url http://localhost:31284
Warning:. Chcpignore does not exist.
Build 2015.09.02-10.17.48 created in/cordova/testproject/www
cordova-hcp local server available at:http:// localhost:31284
cordova-hcp Public server available at:https://5027caf9.ngrok.com
Open a new console, go to the project root directory, run the app:
Ionic Run
Wait, the app will be installed on the phone or simulator.
Now open testproject/www/index.html, make some changes and save. After a few seconds you can see the updated page on your phone or simulator.
Here, you can develop it locally and the new Web content will be automatically updated on the device without restarting the app to see the effect. Flowchart of the update mechanism
Prevent all configuration-related content from making you confused-first take a look at the flowchart of this plugin's implementation update function. There should be no technical details.
The user opens your app.
Plug-in initialization, which starts the upgrade loader in the background process (