content: package com.allen.androiddevcoder;
  
  import android.os.Bundle;
  import android.support.v7.app.AppCompatActivity;
  
  import com.facebook.react.LifecycleState;
  import com.facebook.react.ReactInstanceManager;
  import com.facebook.react.ReactRootView;
  import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
  import com.facebook.react.shell.MainReactPackage;
  
  public class MainActivity extends AppCompatActivity implements DefaultHardwareBackBtnHandler {
  private ReactRootView mReactRootView;
  private ReactInstanceManager mReactInstanceManager;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      mReactRootView = new ReactRootView(this);
      mReactInstanceManager = ReactInstanceManager.builder()
              .setApplication(getApplication())
              .setBundleAssetName("index.android.bundle")
              .setJSMainModuleName("index.android")
              .addPackage(new MainReactPackage())
              .setUseDeveloperSupport(BuildConfig.DEBUG)
              .setInitialLifecycleState(LifecycleState.RESUMED)
              .build();
      mReactRootView.startReactApplication(mReactInstanceManager, "react-native-module", null);
      setContentView(mReactRootView);
  }
      @Override
      protected void onPause() {
          super.onPause();
  
          if (mReactInstanceManager != null) {
              mReactInstanceManager.onHostPause();
          }
      }
  
      @Override
      protected void onResume() {
          super.onResume();
  
          if (mReactInstanceManager != null) {
              mReactInstanceManager.onHostResume(this, this);
          }
      }
      @Override
      public void invokeDefaultOnBackPressed() {
          if (mReactInstanceManager != null) {
              mReactInstanceManager.onBackPressed();
          } else {
              super.onBackPressed();
          }
      }
  }
  