Skip to content

Commit

Permalink
Fix: Fixed restart app issue when restoring backup.
Browse files Browse the repository at this point in the history
  • Loading branch information
CreativeCodeCat committed Dec 2, 2024
1 parent 3defd8f commit 011bd02
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ object AppReloader {
val componentName = intent?.component
val mainIntent = Intent.makeRestartActivityTask(componentName)
mainIntent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP
mainIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK

// Delay the restart slightly to ensure all current activities are finished
Handler(Looper.getMainLooper()).post {
Handler(Looper.getMainLooper()).postDelayed({
context.startActivity(mainIntent)
Runtime.getRuntime().exit(0)
}
}, 250)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,7 @@ class MainActivity : AppCompatActivity() {
}
}
applicationContext.showShortToast(getString(R.string.settings_reload_app_restore))
Handler(Looper.getMainLooper()).postDelayed({
AppReloader.restartApp(applicationContext)
}, 500)
AppReloader.restartApp(applicationContext)
}

Constants.BACKUP_WRITE -> {
Expand Down

0 comments on commit 011bd02

Please sign in to comment.