Add option to show exception from the background task logic main loop

This commit is contained in:
Jonas Lochmann 2019-09-09 00:00:00 +00:00
parent 422e823c29
commit 6dbb7579e8
No known key found for this signature in database
GPG key ID: 8B8C9AEE10FA5B36
5 changed files with 29 additions and 0 deletions

View file

@ -49,6 +49,7 @@ import java.util.*
class BackgroundTaskLogic(val appLogic: AppLogic) {
var pauseBackgroundLoop = false
val lastLoopException = MutableLiveData<Exception?>().apply { value = null }
companion object {
private const val CHECK_PERMISSION_INTERVAL = 10 * 1000L // all 10 seconds
@ -531,6 +532,7 @@ class BackgroundTaskLogic(val appLogic: AppLogic) {
}
} catch (ex: SecurityException) {
// this is handled by an other main loop (with a delay)
lastLoopException.postValue(ex)
appLogic.platformIntegration.setAppStatusMessage(AppStatusMessage(
appLogic.context.getString(R.string.background_logic_error),
@ -542,6 +544,8 @@ class BackgroundTaskLogic(val appLogic: AppLogic) {
Log.w(LOG_TAG, "exception during running main loop", ex)
}
lastLoopException.postValue(ex)
appLogic.platformIntegration.setAppStatusMessage(AppStatusMessage(
appLogic.context.getString(R.string.background_logic_error),
appLogic.context.getString(R.string.background_logic_error_internal)