From fb60c8d554c3e6f647e4f577017cf749e1ae11c8 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Tue, 5 May 2026 11:36:07 -0300 Subject: [PATCH] Try to auto-start after updating ourselves --- .../kotlin/org/fdroid/install/AppUpdateReceiver.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/src/main/kotlin/org/fdroid/install/AppUpdateReceiver.kt b/app/src/main/kotlin/org/fdroid/install/AppUpdateReceiver.kt index 12c638acd..b85cf3e9a 100644 --- a/app/src/main/kotlin/org/fdroid/install/AppUpdateReceiver.kt +++ b/app/src/main/kotlin/org/fdroid/install/AppUpdateReceiver.kt @@ -4,6 +4,7 @@ import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.content.Intent.ACTION_MY_PACKAGE_REPLACED +import android.content.Intent.FLAG_ACTIVITY_NEW_TASK import androidx.annotation.RequiresApi import mu.KotlinLogging @@ -18,5 +19,16 @@ class AppUpdateReceiver : BroadcastReceiver() { return } log.info { "Intent received, we just updated ourselves!" } + val intent = + context.packageManager.getLaunchIntentForPackage(context.packageName)?.apply { + addFlags(FLAG_ACTIVITY_NEW_TASK) + } + if (intent != null) { + try { + context.startActivity(intent) + } catch (e: Exception) { + log.error(e) { "Failed to start activity after update" } + } + } } }