mirror of
https://github.com/syncthing/syncthing-android.git
synced 2025-01-09 19:53:33 +00:00
Automatically restart app after update (fixes #845)
This commit is contained in:
parent
dca4c32723
commit
3e85a5c182
2 changed files with 3 additions and 2 deletions
|
@ -124,6 +124,7 @@
|
||||||
<receiver android:name=".receiver.BootReceiver">
|
<receiver android:name=".receiver.BootReceiver">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
|
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
<receiver android:name=".receiver.AppConfigReceiver"
|
<receiver android:name=".receiver.AppConfigReceiver"
|
||||||
|
|
|
@ -10,7 +10,8 @@ public class BootReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
if (!intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED))
|
if (!intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED) &&
|
||||||
|
!intent.getAction().equals(Intent.ACTION_MY_PACKAGE_REPLACED))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!SyncthingService.alwaysRunInBackground(context))
|
if (!SyncthingService.alwaysRunInBackground(context))
|
||||||
|
@ -18,5 +19,4 @@ public class BootReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
context.startService(new Intent(context, SyncthingService.class));
|
context.startService(new Intent(context, SyncthingService.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue