Skip to content

Commit 9964809

Browse files
authored
Update IdeApplication.java
1 parent 640b21e commit 9964809

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

app/src/main/java/com/eup/codeopsstudio/IdeApplication.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,7 @@ public void uncaughtException(Thread thread, Throwable throwable) {
119119
restartIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
120120
startActivity(restartIntent);
121121
// Kill the process after a delay to allow Crashlytics to log reports completely
122-
AsyncTask.runLaterOnUiThread(()-> {
123-
Process.killProcess(Process.myPid());
124-
System.exit(1);
125-
},2000); // 2 second delay
122+
scheduleProcessTermination();
126123
} catch (Throwable e) {
127124
crashlytics.recordException(e);
128125
e.printStackTrace();
@@ -205,4 +202,17 @@ public static String getArch() {
205202
}
206203
throw new UnsupportedOperationException("Device not supported");
207204
}
205+
206+
private void scheduleProcessTermination() {
207+
new Thread(() -> {
208+
try {
209+
Thread.sleep(2000); // 2-second delay
210+
} catch (InterruptedException e) {
211+
// Handle the interruption
212+
}
213+
// Terminate the process
214+
Process.killProcess(Process.myPid());
215+
System.exit(1);
216+
}).start();
217+
}
208218
}

0 commit comments

Comments
 (0)