You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[Plugin Installation and Configuration for React Native 0.60 version and above](#plugin-installation-and-configuration-for-react-native-060-version-and-above-android)
4
-
*[Plugin Installation for React Native lower than 0.60 (Android)](#plugin-installation-for-react-native-lower-than-060-android)
-[Plugin Installation and Configuration for React Native 0.60 version and above](#plugin-installation-and-configuration-for-react-native-060-version-and-above-android)
4
+
-[Plugin Installation for React Native lower than 0.60 (Android)](#plugin-installation-for-react-native-lower-than-060-android)
*Note: If you need to dynamically use a different deployment, you can also override your deployment key in JS code using [Code-Push options](./api-js.md#CodePushOptions)*
103
+
_Note: If you need to dynamically use a different deployment, you can also override your deployment key in JS code using [Code-Push options](./api-js.md#CodePushOptions)_
104
104
105
105
### Plugin Installation for React Native lower than 0.60 (Android)
106
106
@@ -110,21 +110,23 @@ In order to accommodate as many developer preferences as possible, the CodePush
110
110
111
111
2.[**"Manual"**](#plugin-installation-android---manual) - If you don't want to depend on any additional tools or are fine with a few extra installation steps (it's a one-time thing), then go with this approach.
112
112
113
-
*Note: Due to a code change from the React Native repository, if your installed React Native version ranges from 0.29 to 0.32, we recommend following the manual steps to set up correctly. *
113
+
_Note: Due to a code change from the React Native repository, if your installed React Native version ranges from 0.29 to 0.32, we recommend following the manual steps to set up correctly. _
114
114
115
115
#### Plugin Installation (Android - RNPM)
116
116
117
117
1. As of v0.27 of React Native, `rnpm link` has already been merged into the React Native CLI. Simply run:
118
-
```
119
-
react-native link react-native-code-push
120
-
```
121
118
122
-
If your app uses a version of React Native that is lower than v0.27, run the following:
123
-
```
124
-
rnpm link react-native-code-push
125
-
```
119
+
```
120
+
react-native link react-native-code-push
121
+
```
122
+
123
+
If your app uses a version of React Native that is lower than v0.27, run the following:
126
124
127
-
*Note: If you don't already have RNPM installed, you can do so by simply running `npm i -g rnpm` and then executing the above command.*
125
+
```
126
+
rnpm link react-native-code-push
127
+
```
128
+
129
+
_Note: If you don't already have RNPM installed, you can do so by simply running `npm i -g rnpm` and then executing the above command._
128
130
129
131
2. If you're using RNPM >=1.6.0, you will be prompted for the deployment key you'd like to use. If you don't already have it, you can retrieve this value by running `appcenter codepush deployment list -a <ownerName>/<appName> -k`, or you can choose to ignore it (by simply hitting `<ENTER>`) and add it in later. To get started, we would recommend just using your `Staging` deployment key, so that you can test out the CodePush end-to-end.
130
132
@@ -134,33 +136,33 @@ And that's it for installation using RNPM! Continue below to the [Plugin Configu
134
136
135
137
1. In your `android/settings.gradle` file, make the following additions:
136
138
137
-
```gradle
138
-
include ':app', ':react-native-code-push'
139
-
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
140
-
```
139
+
```gradle
140
+
include ':app', ':react-native-code-push'
141
+
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
142
+
```
141
143
142
144
2. In your `android/app/build.gradle` file, add the `:react-native-code-push` project as a compile-time dependency:
143
145
144
-
```gradle
145
-
...
146
-
dependencies {
147
-
...
148
-
compile project(':react-native-code-push')
149
-
}
150
-
```
146
+
```gradle
147
+
...
148
+
dependencies {
149
+
...
150
+
compile project(':react-native-code-push')
151
+
}
152
+
```
151
153
152
154
3. In your `android/app/build.gradle` file, add the `codepush.gradle` file as an additional build task definition underneath `react.gradle`:
### Plugin Configuration for React Native lower than 0.60 (Android)
162
164
163
-
*NOTE: If you used RNPM or `react-native link` to automatically link the plugin, these steps have already been done for you so you may skip this section.*
165
+
_NOTE: If you used RNPM or `react-native link` to automatically link the plugin, these steps have already been done for you so you may skip this section._
164
166
165
167
After installing the plugin and syncing your Android Studio project with Gradle, you need to configure your app to consult CodePush for the location of your JS bundle, since it will "take control" of managing the current and all future versions. To do this:
166
168
@@ -203,7 +205,8 @@ public class MainApplication extends Application implements ReactApplication {
203
205
}
204
206
```
205
207
206
-
*NOTE: For React Native v0.49+ please be sure that `getJSMainModuleName` function in the `MainApplication.java` file determines correct URL to fetch JS bundle (used when dev support is enabled, see [this](https://github.com/facebook/react-native/blob/c7f37074ac89f7e568ca26a6bad3bdb02812c39f/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.java#L124) for more details) e.g.*
208
+
_NOTE: For React Native v0.49+ please be sure that `getJSMainModuleName` function in the `MainApplication.java` file determines correct URL to fetch JS bundle (used when dev support is enabled, see [this](https://github.com/facebook/react-native/blob/c7f37074ac89f7e568ca26a6bad3bdb02812c39f/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.java#L124) for more details) e.g._
209
+
207
210
```
208
211
@Override
209
212
protected String getJSMainModuleName() {
@@ -236,7 +239,7 @@ public class MyReactActivity extends Activity {
@@ -283,7 +286,7 @@ public class MainActivity extends ReactActivity {
283
286
284
287
#### Background React Instances
285
288
286
-
*This section is only necessary if you're <b>explicitly</b> launching a React Native instance without an `Activity` (for example, from within a native push notification receiver). For these situations, CodePush must be told how to find your React Native instance.*
289
+
_This section is only necessary if you're <b>explicitly</b> launching a React Native instance without an `Activity` (for example, from within a native push notification receiver). For these situations, CodePush must be told how to find your React Native instance._
287
290
288
291
In order to update/restart your React Native instance, CodePush must be configured with a `ReactInstanceHolder` before attempting to restart an instance in the background. This is done in your `Application` implementation.
289
292
@@ -397,6 +400,7 @@ public class MainApplication extends NavigationApplication implements ReactInsta
397
400
}
398
401
}
399
402
```
403
+
400
404
If you are using [WIX React Native Navigation **version 2.x**](https://github.com/wix/react-native-navigation/tree/v2) based application, please do the following steps to integrate CodePush:
401
405
402
406
1. As per React Native Navigation's documentation, `MainActivity.java` should extend `NavigationActivity`, no changes required to incorporate CodePush:
@@ -433,7 +437,7 @@ public class MainApplication extends NavigationApplication {
433
437
protectedStringgetJSBundleFile() {
434
438
returnCodePush.getJSBundleFile();
435
439
}
436
-
440
+
437
441
};
438
442
returnnewReactGateway(this, isDebug(), host);
439
443
}
@@ -451,12 +455,12 @@ public class MainApplication extends NavigationApplication {
451
455
452
456
Starting with CLI version **2.1.0** you can self sign bundles during release and verify its signature before installation of update. For more info about CodeSigning please refer to [relevant code-push documentation section](https://github.com/microsoft/code-push/tree/v3.0.1/cli#code-signing). In order to use Public Key for Code Signing you need to do following steps:
453
457
454
-
Add `CodePushPublicKey` string item to `/path_to_your_app/android/app/src/main/res/values/strings.xml`.It may looks like this:
458
+
Add `CodePushPublicKey` string item to `/path_to_your_app/android/app/src/main/res/values/strings.xml`.It may looks like this:
0 commit comments