Example of how to use Microsoft CodePush with ionic2
npm install -g typings
npm install -g tslint
npm install -g code-push-cli
npm install
typings install
ionic hooks add
ionic state restore
code-push login
Above command will open the browser and you will have the option to sign using various providers. I used Microsoft (Personal) account for this example.
On successful authentication the browser will display the token. Paste this token on the prompt in your console.
You are now logged in
It is recommended to register one app per platform so for this project I am doing
code-push app add ionic2-sample-ios
and
code-push app add ionic2-sample-android
ionic plugin add cordova-plugin-code-push@latest
code-push deployment ls ionic2-sample-ios -k
You will see two environments (Staging and Production)
<platform name="android">
<preference name="CodePushDeploymentKey" value="YOUR-ANDROID-DEPLOYMENT-KEY" />
</platform>
<platform name="ios">
<preference name="CodePushDeploymentKey" value="YOUR-IOS-DEPLOYMENT-KEY" />
</platform>
The code base currently has my key in the config.xml so make sure to replace it with yours.
ionic emulate ios
You will some progress text with activity indicator and then you will switch to TabsPage
Modify home.html or anything of your assets (scss/ts/html) and issue following command
code-push release-cordova ionic2-sample-ios ios
You can see the update by issuing following command :
code-push deployment ls ionic2-sample-ios
Restart the app ( note - don't do -> ionic emulate ios as this will load the current compiled version in your emulator :) )
You can also see how many of the devices got the update by issuing following command
code-push deployment ls ionic2-sample-ios