@@ -80,6 +80,8 @@ private boolean isReactApplication(Context context) {
8080 }
8181
8282 private void loadBundleLegacy (final Activity currentActivity ) {
83+ CodePushUtils .log ("Legacy restart logic being used" );
84+
8385 mCodePush .invalidateCurrentInstance ();
8486
8587 currentActivity .runOnUiThread (new Runnable () {
@@ -240,19 +242,23 @@ public void dispatchDownloadProgressEvent() {
240242
241243 @ ReactMethod
242244 public void getConfiguration (Promise promise ) {
243- Activity currentActivity = getCurrentActivity ();
244245 WritableNativeMap configMap = new WritableNativeMap ();
245246 configMap .putString ("appVersion" , mCodePush .getAppVersion ());
246247 configMap .putString ("deploymentKey" , mCodePush .getDeploymentKey ());
247248 configMap .putString ("serverUrl" , mCodePush .getServerUrl ());
248- configMap .putString ("clientUniqueId" ,
249- Settings .Secure .getString (currentActivity .getContentResolver (),
250- android .provider .Settings .Secure .ANDROID_ID ));
251- String binaryHash = CodePushUpdateUtils .getHashForBinaryContents (currentActivity , mCodePush .isDebugMode ());
252- if (binaryHash != null ) {
253- // binaryHash will be null if the React Native assets were not bundled into the APK
254- // (e.g. in Debug builds)
255- configMap .putString (CodePushConstants .PACKAGE_HASH_KEY , binaryHash );
249+
250+ Activity currentActivity = getCurrentActivity ();
251+ if (currentActivity != null ) {
252+ configMap .putString ("clientUniqueId" ,
253+ Settings .Secure .getString (currentActivity .getContentResolver (),
254+ android .provider .Settings .Secure .ANDROID_ID ));
255+
256+ String binaryHash = CodePushUpdateUtils .getHashForBinaryContents (currentActivity , mCodePush .isDebugMode ());
257+ if (binaryHash != null ) {
258+ // binaryHash will be null if the React Native assets were not bundled into the APK
259+ // (e.g. in Debug builds)
260+ configMap .putString (CodePushConstants .PACKAGE_HASH_KEY , binaryHash );
261+ }
256262 }
257263
258264 promise .resolve (configMap );
0 commit comments