我必须连续运行的 Cordova android 应用(一种自助服务终端应用)在使用几天后被杀死/崩溃。
使用的插件:
<plugin name="cordova-plugin-whitelist" spec="^1.3.4" />
<plugin name="cordova-plugin-device" spec="^2.0.3" />
<plugin name="cordova-plugin-splashscreen" spec="^6.0.0" />
<plugin name="cordova-plugin-inappbrowser" spec="^5.0.0" />
<plugin name="cordova-plugin-network-information" spec="^2.0.2" />
<plugin name="com.cordova.plugins.cookiemaster" spec="~1.0.1" />
<plugin name="cordova-plugin-customurlscheme" spec="^5.0.2">
<plugin name="cordova-plugin-awesome-shared-preferences" spec="^0.1.0" />
<plugin name="cordova.plugins.diagnostic" spec="^6.0.3" />
<plugin name="sentry-cordova" spec="^0.17.0" />
也尝试了 android 内存分析,但没有出现任何内存泄漏,但注意到内存随着时间的推移不断增加。
任何建议,我该如何在几天后修复此崩溃/终止?
尝试处理未捕获的异常并在崩溃时重新启动应用程序,但没有成功
public static final String TAG = "uncaughtException";
public void uncaughtException(Thread thread, Throwable exception) {
if (myContext != null) {
PackageManager pm = myContext.getPackageManager();
if (pm != null) {
Intent mStartActivity = pm.getLaunchIntentForPackage(
myContext.getPackageName()
);
if (mStartActivity != null) {
mStartActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
myContext.getApplicationContext().startActivity(mStartActivity);
Log.i(TAG, "Killing application for cold restart");
//kill the application
System.exit(0);
}
}
}
}