diff --git a/android/src/main/java/com/ninty/system/setting/SystemSetting.java b/android/src/main/java/com/ninty/system/setting/SystemSetting.java index 4c85c19..a6b1e4b 100644 --- a/android/src/main/java/com/ninty/system/setting/SystemSetting.java +++ b/android/src/main/java/com/ninty/system/setting/SystemSetting.java @@ -76,8 +76,13 @@ public void onReceive(Context context, Intent intent) { para.putDouble(VOL_MUSIC, getNormalizationVolume(VOL_MUSIC)); para.putDouble(VOL_ALARM, getNormalizationVolume(VOL_ALARM)); para.putDouble(VOL_NOTIFICATION, getNormalizationVolume(VOL_NOTIFICATION)); - reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) + try { + reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) .emit("EventVolume", para); + } catch (RuntimeException e) { + // Possible to interact with volume before JS bundle execution is finished. + // This is here to avoid app crashing. + } } } };