|
|
@ -22,12 +22,21 @@ package eu.faircode.email;
|
|
|
|
import android.content.BroadcastReceiver;
|
|
|
|
import android.content.BroadcastReceiver;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.Intent;
|
|
|
|
|
|
|
|
import android.util.Log;
|
|
|
|
|
|
|
|
|
|
|
|
public class ReceiverAutostart extends BroadcastReceiver {
|
|
|
|
public class ReceiverAutostart extends BroadcastReceiver {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onReceive(Context context, Intent intent) {
|
|
|
|
public void onReceive(final Context context, Intent intent) {
|
|
|
|
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction()) ||
|
|
|
|
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction()) ||
|
|
|
|
Intent.ACTION_MY_PACKAGE_REPLACED.equals(intent.getAction()))
|
|
|
|
Intent.ACTION_MY_PACKAGE_REPLACED.equals(intent.getAction()))
|
|
|
|
ServiceSynchronize.start(context);
|
|
|
|
new Thread(new Runnable() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
int synchronizing = DB.getInstance(context).account().getSynchronizingAccountCount();
|
|
|
|
|
|
|
|
Log.i(Helper.TAG, "Synchronizing accounts=" + synchronizing);
|
|
|
|
|
|
|
|
if (synchronizing > 0)
|
|
|
|
|
|
|
|
ServiceSynchronize.start(context);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}).start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|