Log when we updated ourselves

so we can test if it is feasible to auto-restart the app
This commit is contained in:
Torsten Grote
2026-05-04 11:46:08 -03:00
parent fdd5dd65bf
commit 01b85e6dbe
2 changed files with 30 additions and 0 deletions

View File

@@ -161,6 +161,14 @@
<action android:name="android.intent.action.UNARCHIVE_PACKAGE" />
</intent-filter>
</receiver>
<receiver
android:name="org.fdroid.install.AppUpdateReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
</application>
</manifest>

View File

@@ -0,0 +1,22 @@
package org.fdroid.install
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.Intent.ACTION_MY_PACKAGE_REPLACED
import androidx.annotation.RequiresApi
import mu.KotlinLogging
class AppUpdateReceiver : BroadcastReceiver() {
private val log = KotlinLogging.logger {}
@RequiresApi(35)
override fun onReceive(context: Context, intent: Intent) {
if (intent.action != ACTION_MY_PACKAGE_REPLACED) {
log.warn { "Unknown action: ${intent.action}" }
return
}
log.info { "Intent received, we just updated ourselves!" }
}
}