Fixed: ErrorActivity was not appearing in the non-debug version when the application crashed.

* We are using the `applicationContext` to start the `ErrorActivity`, which is outside the `Activity`. Therefore, to initiate the activity with an external context of the `Activity`, we must include the `FLAG_ACTIVITY_NEW_TASK` flag in the intent. Without this flag, the activity will not start.
This commit is contained in:
MohitMaliFtechiz 2023-12-20 18:36:19 +05:30 committed by Kelson
parent fa3e2d1aab
commit f7e14162fc

View File

@ -18,6 +18,7 @@
package org.kiwix.kiwixmobile.core.main
import android.content.Intent
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
import android.os.Bundle
import android.os.Process
import android.view.ActionMode
@ -96,6 +97,7 @@ abstract class CoreMainActivity : BaseActivity(), WebViewProvider {
val extras = Bundle()
extras.putSerializable(ErrorActivity.EXCEPTION_KEY, paramThrowable)
intent.putExtras(extras)
intent.addFlags(FLAG_ACTIVITY_NEW_TASK)
appContext.startActivity(intent)
finish()
Process.killProcess(Process.myPid())