@@ -66,6 +66,8 @@ After installing the plugin and syncing your Android Studio project with Gradle,
66
66
67
67
**For React Native >= v0.29**
68
68
69
+ If you are integrating Code Push into React Native application please do the following steps:
70
+
69
71
Update the `MainApplication.java` file to use CodePush via the following changes:
70
72
71
73
```java
@@ -107,6 +109,40 @@ protected String getJSMainModuleName() {
107
109
}
108
110
```
109
111
112
+ If you are integrating React Native into existing native application please do the following steps:
113
+
114
+ Update ` MyReactActivity.java ` (it could be named differently in your app) file to use CodePush via the following changes:
115
+
116
+ ``` java
117
+ ...
118
+ // 1. Import the plugin class.
119
+ import com.microsoft.codepush.react.CodePush ;
120
+
121
+ public class MyReactActivity extends Activity {
122
+ private ReactRootView mReactRootView;
123
+ private ReactInstanceManager mReactInstanceManager;
124
+
125
+ @Override
126
+ protected void onCreate (Bundle savedInstanceState ) {
127
+ ...
128
+ mReactInstanceManager = ReactInstanceManager . builder()
129
+ // ...
130
+ // Add CodePush package
131
+ .addPackage(new CodePush (" deployment-key-here" , getApplicationContext(), BuildConfig . DEBUG ))
132
+ // Get the JS Bundle File via Code Push
133
+ .setJSBundleFile(CodePush . getJSBundleFile())
134
+ // ...
135
+
136
+ .build();
137
+ mReactRootView. startReactApplication(mReactInstanceManager, " MyReactNativeApp" , null );
138
+
139
+ setContentView(mReactRootView);
140
+ }
141
+
142
+ ...
143
+ }
144
+ ```
145
+
110
146
** For React Native v0.19 - v0.28**
111
147
112
148
Update the ` MainActivity.java ` file to use CodePush via the following changes:
@@ -236,4 +272,4 @@ new CodePushBuilder("deployment-key-here",getApplicationContext())
236
272
.setIsDebugMode(BuildConfig . DEBUG )
237
273
.setPublicKeyResourceDescriptor(R . string. CodePushPublicKey )
238
274
.build()
239
- ```
275
+ ```
0 commit comments