Skip to content

Instantly share code, notes, and snippets.

Created August 2, 2020 03:36
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Integrating CodePush 3
// File: android/app/src/main/java/com/myapp/
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
+ import; // 1. CodePush
public class MainApplication extends MultiDexApplication implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
protected List<ReactPackage> getPackages() {
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
protected String getJSMainModuleName() {
return "index";
+ // 2. CODEPUSH: Override the getJSBundleFile method in order to let
+ // the CodePush runtime determine where to get the JS
+ // bundle location from on each app start
+ @Override
+ protected String getJSBundleFile() {
+ return CodePush.getJSBundleFile();
+ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment