Automatically restart app after update (fixes #845)

This commit is contained in:
Felix Ableitner 2017-09-27 09:31:48 +09:00
parent dca4c32723
commit 3e85a5c182
2 changed files with 3 additions and 2 deletions

View File

@ -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"

View File

@ -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));
} }
} }