diff --git a/app/src/main/java/com/aws/amazonlocation/AmazonLocationApp.kt b/app/src/main/java/com/aws/amazonlocation/AmazonLocationApp.kt
index 7adf5134..88eb80ed 100644
--- a/app/src/main/java/com/aws/amazonlocation/AmazonLocationApp.kt
+++ b/app/src/main/java/com/aws/amazonlocation/AmazonLocationApp.kt
@@ -4,9 +4,10 @@ import android.app.Application
import androidx.appcompat.app.AppCompatDelegate
import com.aws.amazonlocation.ui.main.CrashListener
import com.aws.amazonlocation.utils.AmplifyHelper
+import com.aws.amazonlocation.utils.KEY_APP_CRASH
+import com.aws.amazonlocation.utils.PreferenceManager
import dagger.hilt.android.HiltAndroidApp
import javax.inject.Inject
-import kotlin.system.exitProcess
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -16,6 +17,8 @@ class AmazonLocationApp : Application() {
@Inject
lateinit var amplifyHelper: AmplifyHelper
+ @Inject
+ lateinit var mPreferenceManager: PreferenceManager
private var crashListener: CrashListener? = null
override fun onCreate() {
@@ -25,9 +28,8 @@ class AmazonLocationApp : Application() {
}
private fun setupUncaughtExceptionHandler() {
Thread.setDefaultUncaughtExceptionHandler { _, throwable ->
+ mPreferenceManager.setValue(KEY_APP_CRASH, true)
notifyAppCrash(throwable.message)
- android.os.Process.killProcess(android.os.Process.myPid())
- exitProcess(1)
}
}
fun setCrashListener(listener: CrashListener) {
diff --git a/app/src/main/java/com/aws/amazonlocation/ui/main/MainActivity.kt b/app/src/main/java/com/aws/amazonlocation/ui/main/MainActivity.kt
index 0cdc8306..889ea254 100644
--- a/app/src/main/java/com/aws/amazonlocation/ui/main/MainActivity.kt
+++ b/app/src/main/java/com/aws/amazonlocation/ui/main/MainActivity.kt
@@ -230,6 +230,11 @@ class MainActivity : BaseActivity(), CrashListener {
val languageCode = getLanguageCode()
languageCode?.let { setLocale(it, applicationContext) }
}
+ val isAppCrashed = mPreferenceManager.getBooleanValue(KEY_APP_CRASH, false)
+ if (isAppCrashed) {
+ mPreferenceManager.setValue(KEY_APP_CRASH, false)
+ appCrashedDialog()
+ }
}
// check rtl layout
@@ -967,6 +972,7 @@ class MainActivity : BaseActivity(), CrashListener {
)
analyticsHelper?.recordEvent(EventType.APPLICATION_ERROR, properties)
}
+ restartApplication()
}
}
}
diff --git a/app/src/main/java/com/aws/amazonlocation/utils/Constants.kt b/app/src/main/java/com/aws/amazonlocation/utils/Constants.kt
index f3629820..d8d8eb41 100644
--- a/app/src/main/java/com/aws/amazonlocation/utils/Constants.kt
+++ b/app/src/main/java/com/aws/amazonlocation/utils/Constants.kt
@@ -32,6 +32,7 @@ const val KEY_MAP_NAME = "key_map_name"
const val KEY_MAP_STYLE_NAME = "key_map_style_name"
const val KEY_GRAB_DONT_ASK = "key_grab_dont_ask"
const val KEY_OPEN_DATA_DONT_ASK = "key_open_data_dont_ask"
+const val KEY_APP_CRASH = "key_app_crash"
const val CLICK_DEBOUNCE = 1000L
const val CLICK_DEBOUNCE_ENABLE = 1200L
const val RESTART_DELAY = 800L
diff --git a/app/src/main/java/com/aws/amazonlocation/utils/DialogUtils.kt b/app/src/main/java/com/aws/amazonlocation/utils/DialogUtils.kt
index c5dc28f2..42cd3b34 100644
--- a/app/src/main/java/com/aws/amazonlocation/utils/DialogUtils.kt
+++ b/app/src/main/java/com/aws/amazonlocation/utils/DialogUtils.kt
@@ -289,6 +289,18 @@ fun Context.changeDataProviderDialog(
mDialog.show()
}
+fun Context.appCrashedDialog() {
+ val mDialog = MaterialAlertDialogBuilder(this, R.style.LogOutStyle)
+ mDialog.setTitle(resources.getString(R.string.app_name))
+ mDialog.setMessage(this.resources.getString(R.string.label_app_crash))
+ mDialog.setPositiveButton(
+ this.resources.getString(R.string.ok)
+ ) { dialog, _ ->
+ dialog.dismiss()
+ }
+ mDialog.show()
+}
+
interface EnableTrackerInterface {
fun continueToTracker(dialog: DialogInterface)
fun cancel()
@@ -332,4 +344,4 @@ interface SimulationDialogInterface {
interface NotificationDialogInterface {
fun onOkClick(dialog: DialogInterface)
fun onCancelClick(dialog: DialogInterface)
-}
+}
\ No newline at end of file
diff --git a/app/src/main/res/values-ar/string.xml b/app/src/main/res/values-ar/string.xml
index d112460f..a182e6f3 100644
--- a/app/src/main/res/values-ar/string.xml
+++ b/app/src/main/res/values-ar/string.xml
@@ -281,4 +281,5 @@
المنطقة
تمكين البيانات المفتوحة
البيانات المفتوحة يستخدم إسري من أجل المسارات و الأماكن بحث وظائف إلى تعزيز ك تجربة.
+ مستحق إلى بعض غير عادي نشاط، ال تطبيق لديه تم إعادة التشغيل.
\ No newline at end of file
diff --git a/app/src/main/res/values-de/string.xml b/app/src/main/res/values-de/string.xml
index 93d16722..af815e97 100644
--- a/app/src/main/res/values-de/string.xml
+++ b/app/src/main/res/values-de/string.xml
@@ -281,4 +281,5 @@
Region
Aktivieren Daten öffnen
Daten öffnen Verwendungszwecke Esri zum Strecken und Orte Suche Funktionalität zu verbessern dein erleben.
+ Fällig zu einige ungewöhnlich Aktivität, die Anwendung hat gewesen neu gestartet.
\ No newline at end of file
diff --git a/app/src/main/res/values-es/string.xml b/app/src/main/res/values-es/string.xml
index 1861730b..6470f094 100644
--- a/app/src/main/res/values-es/string.xml
+++ b/app/src/main/res/values-es/string.xml
@@ -281,4 +281,5 @@
Región
Habilitar Datos abiertos
Datos abiertos usos Esri por Rutas y Lugares búsqueda funcionalidad a mejorar vuestro experiencia.
+ Debido a algunos inusual actividad, la aplicación ha estado reiniciado.
\ No newline at end of file
diff --git a/app/src/main/res/values-fr/string.xml b/app/src/main/res/values-fr/string.xml
index e4c2e0a5..d335414c 100644
--- a/app/src/main/res/values-fr/string.xml
+++ b/app/src/main/res/values-fr/string.xml
@@ -281,4 +281,5 @@
Région
Activer Données ouvertes
Données ouvertes les usages Esri pour Itinéraires et Lieux chercher fonctionnalité pour améliorer votre expérience.
+ Dû pour quelques inhabituel activité, le candidature a été redémarré.
\ No newline at end of file
diff --git a/app/src/main/res/values-hi/string.xml b/app/src/main/res/values-hi/string.xml
index bf6151dd..7b705774 100644
--- a/app/src/main/res/values-hi/string.xml
+++ b/app/src/main/res/values-hi/string.xml
@@ -281,4 +281,5 @@
क्षेत्र
चालू करें ओपनडेटा
ओपनडेटा का उपयोग करता है एसरी के लिए रूट्स और जगहें तलाश कार्यक्षमता को बढ़ाने के लिए तुम्हारा अनुभव।
+ देय को कुछ असामान्य गतिविधि, यह आवेदन पास है गया पुनः आरंभ।
\ No newline at end of file
diff --git a/app/src/main/res/values-it/string.xml b/app/src/main/res/values-it/string.xml
index 203e6f72..b117cb07 100644
--- a/app/src/main/res/values-it/string.xml
+++ b/app/src/main/res/values-it/string.xml
@@ -281,4 +281,5 @@
Regione
Abilita Dati aperti
Dati aperti utilizza Esri per Percorsi e Luoghi ricerca funzionalità a accrescere tuo esperienza.
+ Dovuto a alcuni insolito attività, lo candidatura ha stato riavviato.
\ No newline at end of file
diff --git a/app/src/main/res/values-iw/string.xml b/app/src/main/res/values-iw/string.xml
index 9a27a12c..60bba1b5 100644
--- a/app/src/main/res/values-iw/string.xml
+++ b/app/src/main/res/values-iw/string.xml
@@ -281,4 +281,5 @@
אזור
הפעל OpenData
OpenData משתמש Esri בשביל מסלולים ו מקומות חפש פונקציונליות כדי לשפר שלך ניסיון.
+ בשל כדי קצת יוצא דופן פעילות, ה יישום יש ל היה הופעל מחדש.
\ No newline at end of file
diff --git a/app/src/main/res/values-ja/string.xml b/app/src/main/res/values-ja/string.xml
index 290bda11..e561d7d9 100644
--- a/app/src/main/res/values-ja/string.xml
+++ b/app/src/main/res/values-ja/string.xml
@@ -281,4 +281,5 @@
リージョン
有効化 オープンデータ
オープンデータ 使用する Esri にとって ルート そして 場所 検索 機能性 に 強化します きみの 経験。
+ 期限 に 一部 珍しい アクティビティ、 その 応用 持っている されている 再起動しました。
\ No newline at end of file
diff --git a/app/src/main/res/values-ko/string.xml b/app/src/main/res/values-ko/string.xml
index 7cc06f5d..159dc9f7 100644
--- a/app/src/main/res/values-ko/string.xml
+++ b/app/src/main/res/values-ko/string.xml
@@ -281,4 +281,5 @@
지역
활성화 오픈 데이터
오픈 데이터 사용 에스리 ...에 대한 노선 과 장소 수색 기능성 에 높이다 당신의 경험.
+ 기한 에 약간 별난 활동, 그 응용 프로그램 가지고 있습니다 있었다 이 (가) 다시 시작되었습니다.
\ No newline at end of file
diff --git a/app/src/main/res/values-pt/string.xml b/app/src/main/res/values-pt/string.xml
index fac400c5..917f6d89 100644
--- a/app/src/main/res/values-pt/string.xml
+++ b/app/src/main/res/values-pt/string.xml
@@ -281,4 +281,5 @@
Região
Habilitar Dados abertos
Dados abertos usa Esri pelo Rotas e Locais procurar funcionalidade para aumentar seu experiência.
+ Devida para alguns incomum atividade, a aplicativo tem fui reiniciado.
\ No newline at end of file
diff --git a/app/src/main/res/values-zh-rCN/string.xml b/app/src/main/res/values-zh-rCN/string.xml
index 4886c580..fb714945 100644
--- a/app/src/main/res/values-zh-rCN/string.xml
+++ b/app/src/main/res/values-zh-rCN/string.xml
@@ -281,4 +281,5 @@
区域
启用 开放数据
开放数据 使用 Esri 为了 路线 和 地点 搜索 功能 到 提高 您的 经验。
+ 到期 到 一些 不寻常 活动, 这 应用程序 有 是 已重新启动。
\ No newline at end of file
diff --git a/app/src/main/res/values-zh-rTW/string.xml b/app/src/main/res/values-zh-rTW/string.xml
index 444ec5d7..e0792c10 100644
--- a/app/src/main/res/values-zh-rTW/string.xml
+++ b/app/src/main/res/values-zh-rTW/string.xml
@@ -281,4 +281,5 @@
地區
啟用 开放数据
开放数据 使用 埃斯里 為了 路線 和 地方 搜尋 功能 至 提高 你的 經驗。
+ 到期 至 一些 不尋常 活動, 該 應用程式 具有 曾經 重新啟動。
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 0a4be18a..b7437d26 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -298,4 +298,5 @@
Region
Enable OpenData
OpenData uses Esri for Routes and Places search functionality to enhance your experience.
+ Due to some unusual activity, the application has been restarted.
\ No newline at end of file