, , NO WAY Activity, uncaughtException(...) , .
, "" .
1. Activity ( )
android:process=dedicated_process_name Activity. , Activity , , 1- . .
<activity
android:name=".ParentActivity"
android:process="::parent_process" />
2. Force (System.exit(code)) , Activity .
BaseActivity onCrashed(...).
public class BaseActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread paramThread, Throwable paramThrowable) {
Log.e("CRASH_REPORT", "Activity crashed!");
onCrashed(thread, throwable);
System.exit(0);
}
});
}
protected void onCrashed(Thread thread, Throwable throwable) {
}
}
Activity, BaseActivity, , . .
public class SubActivity extends BaseActivity
@Override
protected void onCrashed(Thread thread, Throwable throwable) {
Intent i = new Intent(this, ParentActivity.class);
PendingIntent pi = PendingIntent.getActivity(this, 0, i, 0);
AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
am.set(AlarmManager.RTC, System.currentTimeMillis() + 100, pi);
}
uncaughtException (...) Application, Application , . (, Activity)