appcenter-codepush-demoapp

The React Native application in this repository and its corresponding documentation will help you quickly and easily onboard to Visual Studio App Center Code Push.

Usage no npm install needed!

<script type="module">
  import appcenterCodepushDemoapp from 'https://cdn.skypack.dev/appcenter-codepush-demoapp';
</script>

README

Visual Studio App Center CodePush Demo App for React Native

The React Native application in this repository and its corresponding documentation will help you quickly and easily onboard to Visual Studio App Center Code Push.

About this repository

The App Center React Native Code Push is already integrated within the application. Simply follow the steps below to learn how to use each service.

A guide to quickly get started on using Code Push [https://github.com/microsoft/react-native-code-push].

Installing Code Push plugin

  1. Run this command from the App's root directory: $ npm install --save react-native-code-push

  2. For react-native verions >= 0.27, run : $ react-native link react-native-code-push

    For versions < 0.27, run: $ rnpm link react-native-code-push

If you do not have rnpm, please refer to details at https://docs.microsoft.com/en-us/appcenter/distribution/codepush/react-native

Usage

(from: https://docs.microsoft.com/en-us/appcenter/distribution/codepush/react-native)

By default code-push checks for updates on app start.

  1. Coarse grained usage: Wrapping it around your root component:

    import codePush from "react-native-code-push";
    
    class MyApp extends Component {
    }
    
    MyApp = codePush(MyApp);
    
  2. Fine grained usage: You can manually call the function whenever you want the app to check for updates.

    codePush.sync({installMode: codePush.InstallMode.IMMEDIATE, ...})

Pushing Updates

appcenter codepush release-react -a <ownerName>/<appName>

How to run the app

make sure you are running NodeJS (https://nodejs.org/) and have the Android Studio or Android SDK Tools (https://developer.android.com/studio) installed.

Contents

| Tutorial | Description | Screenshot |:-|:-|-| | Push | Send push notifications to your app users | image | | CodePush | Deploy mobile app updates directly to their users’ devices | image |

Other useful information

  1. By default or when you use the code below,

codePush.sync({updateDialog: true, ... });

if user wishes to ignore an update, then he/she will again get the update prompt when the function is called again. A common usecase for this can be an check update button.

  1. You can push a mandatory update using appcenter codepush release-react -a t-susin-microsoft.com/RNTest -m --description "Some changelog"

In this case the user will be forced to update the app. More on this @ https://docs.microsoft.com/en-us/appcenter/distribution/codepush/cli#releasing-updates-react-native

  1. Updates can be rolled out to a percentage of users using -r option. But please read this section: https://docs.microsoft.com/en-us/appcenter/distribution/codepush/cli#rollout-parameter

  2. Also read https://docs.microsoft.com/en-us/appcenter/distribution/codepush/cli#promoting-updates for promoting releases from one deployment to the other.

  3. Broken updates can be rolled back too. Using: https://docs.microsoft.com/en-us/appcenter/distribution/codepush/cli#rolling-back-updates