Integrating code push into existing app
Steps to Reproduce
- I've followed the steps outlined in this guide for integrating RN into an existing android app https://facebook.github.io/react-native/docs/integration-with-existing-apps.html
- I've tried 2 things to integrate microsoft code push. 1) add code push package using the builder methods in reactInstanceHolder
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mReactRootView = new ReactRootView(this);
mReactInstanceManager = ReactInstanceManager.builder()
.setApplication(getApplication())
.setBundleAssetName(null)
.setJSBundleFile(CodePush.getJSBundleFile())
.setJSMainModulePath("index")
.addPackage(new MainReactPackage())
.addPackage(new ActivityStarterReactPackage())
.setUseDeveloperSupport(true)
.addPackage(new CodePush("my-key",this,true))
.setInitialLifecycleState(LifecycleState.RESUMED)
.build();
mReactRootView.startReactApplication(mReactInstanceManager, "AwesomeProject", null);
setContentView(mReactRootView);
}
However this throws a code push exception asking whether a codePush instance has been initialized already (This was expected),
3. The second thing I tried was to make my Application.java implement ReactApplication and provide an instance of reactNativeHost as outlined in the code push android setup. I then changed my ReactActivity to the following
public class MyReactActivity extends ReactActivity {
@Override
protected String getMainComponentName() {
return "AwesomeProject";
}
}
However, when I try to run it this way, it tries to download the bundle from my local dev server and not from the code push servers. Can you let me know what I'm doing wrong here?
Expected Behavior
What you expected to happen? Should download from js bundle from code push server
Actual Behavior
What actually happens? Downloading from local dev server
Environment
- react-native-code-push version: 5.2.0-beta
- react-native version: 0.50
(The more info the faster we will be able to address it!)
Hi @rushabhnagda11 and thanks for submitting the issue. This is expected behavior because CodePush doesn't just replace your local dev server url with codepush server url. You need to configure CodePush on client side of your RN application in order to begin use it.
Please let us know if it helps or you need additional assistance.
Hey ruslan, I've already done this on my client side. My issue is exactly what is specified in 970
Can you let me know what further info I can provide to help you out
Hey, I've managed to fix this issue using what was specified in #970