mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-22 09:58:08 +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:path="/"
|
||||||
android:scheme="package" />
|
android:scheme="package" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
|
||||||
|
</intent-filter>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
@ -37,6 +37,12 @@ public class KdeConnectBroadcastReceiver extends BroadcastReceiver {
|
|||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
|
case Intent.ACTION_MY_PACKAGE_REPLACED:
|
||||||
|
Log.i("KdeConnect", "MyUpdateReceiver");
|
||||||
|
BackgroundService.RunCommand(context, service -> {
|
||||||
|
|
||||||
|
});
|
||||||
|
break;
|
||||||
case Intent.ACTION_PACKAGE_REPLACED:
|
case Intent.ACTION_PACKAGE_REPLACED:
|
||||||
Log.i("KdeConnect", "UpdateReceiver");
|
Log.i("KdeConnect", "UpdateReceiver");
|
||||||
if (!intent.getData().getSchemeSpecificPart().equals(context.getPackageName())) {
|
if (!intent.getData().getSchemeSpecificPart().equals(context.getPackageName())) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user