Showing
2 changed files
with
23 additions
and
0 deletions
This diff is collapsed. Click to expand it.
1 | +package ly.warp.sdk.receivers; | ||
2 | + | ||
3 | +import android.content.BroadcastReceiver; | ||
4 | +import android.content.Context; | ||
5 | +import android.content.Intent; | ||
6 | +import android.os.Build; | ||
7 | + | ||
8 | +import ly.warp.sdk.services.WarplyHealthService; | ||
9 | + | ||
10 | +public class RestartHealthServiceReceiver extends BroadcastReceiver { | ||
11 | + @Override | ||
12 | + public void onReceive(Context context, Intent intent) { | ||
13 | + if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction()) || | ||
14 | + Intent.ACTION_MY_PACKAGE_REPLACED.equals(intent.getAction())) { | ||
15 | + Intent stepsRestartServiceIntent = new Intent(context, WarplyHealthService.class); | ||
16 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | ||
17 | + context.startForegroundService(stepsRestartServiceIntent); | ||
18 | + } else { | ||
19 | + context.startService(stepsRestartServiceIntent); | ||
20 | + } | ||
21 | + } | ||
22 | + } | ||
23 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment