2017-07-03 18:36:31 +00:00
|
|
|
package org.thoughtcrime.securesms.service;
|
|
|
|
|
|
|
|
import android.content.BroadcastReceiver;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
2017-11-27 20:18:14 +00:00
|
|
|
import android.os.Build;
|
2017-07-03 18:36:31 +00:00
|
|
|
|
|
|
|
public class BootReceiver extends BroadcastReceiver {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onReceive(Context context, Intent intent) {
|
2017-11-27 20:18:14 +00:00
|
|
|
if (intent != null && Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
|
|
|
|
Intent messageRetrievalService = new Intent(context, MessageRetrievalService.class);
|
|
|
|
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) context.startForegroundService(messageRetrievalService);
|
|
|
|
else context.startService(messageRetrievalService);
|
|
|
|
}
|
2017-07-03 18:36:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|