Update our boot receiver to schedule a message pull.

Previously we were starting a background service, which isn't allowed
for targetSdk 26. This will do the same thing but at a time decided by
the system.
This commit is contained in:
Greyson Parrelli 2018-10-09 18:45:44 -07:00
parent 4c63428b71
commit 89f97f57cb

View File

@ -5,14 +5,13 @@ import android.content.Context;
import android.content.Intent;
import android.os.Build;
import org.thoughtcrime.securesms.ApplicationContext;
import org.thoughtcrime.securesms.jobs.PushNotificationReceiveJob;
public class BootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent != null && Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
Intent messageRetrievalService = new Intent(context, MessageRetrievalService.class);
context.startService(messageRetrievalService);
}
ApplicationContext.getInstance(context).getJobManager().add(new PushNotificationReceiveJob(context));
}
}