1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-09-18 01:26:10 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

解决某些情况下android不能重启的问题

This commit is contained in:
sunnylqm
2019-09-17 11:52:22 +08:00
parent 1e5d73c0d3
commit 84ffaa7f5a

View File

@@ -135,13 +135,12 @@ public class UpdateModule extends ReactContextBaseJavaModule{
loadField.set(instanceManager, loader);
}
final Method recreateMethod = instanceManager.getClass().getMethod("recreateReactContextInBackground");
try {
instanceManager.recreateReactContextInBackground();
} catch(Throwable err) {
activity.recreate();
}
final ReactInstanceManager finalizedInstanceManager = instanceManager;
recreateMethod.invoke(finalizedInstanceManager);
activity.recreate();
} catch (Throwable err) {
Log.e("pushy", "Failed to restart application", err);
}