mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-22 01:51:47 +00:00
Listen to MY_PACKAGE_REPLACED to restart the service on app upgrades.
The old PACKAGE_REPLACED event doesn't work since Oreo [1]. [1] https://developer.android.com/about/versions/oreo/background.html#broadcasts BUG: 416245
This commit is contained in:
parent
54be4a1a99
commit
386c3cec21
@ -106,6 +106,9 @@
|
||||
android:path="/"
|
||||
android:scheme="package" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
</intent-filter>
|
||||
|
@ -37,6 +37,12 @@ public class KdeConnectBroadcastReceiver extends BroadcastReceiver {
|
||||
String action = intent.getAction();
|
||||
|
||||
switch (action) {
|
||||
case Intent.ACTION_MY_PACKAGE_REPLACED:
|
||||
Log.i("KdeConnect", "MyUpdateReceiver");
|
||||
BackgroundService.RunCommand(context, service -> {
|
||||
|
||||
});
|
||||
break;
|
||||
case Intent.ACTION_PACKAGE_REPLACED:
|
||||
Log.i("KdeConnect", "UpdateReceiver");
|
||||
if (!intent.getData().getSchemeSpecificPart().equals(context.getPackageName())) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user