Skip to content

Commit

Permalink
Merge pull request #38 from shadowcatx/master
Browse files Browse the repository at this point in the history
Exception handling for Volume Event
  • Loading branch information
c19354837 authored Jun 6, 2018
2 parents e924c5d + 984daa3 commit f8c84bc
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
}
}
};
Expand Down

0 comments on commit f8c84bc

Please sign in to comment.