public boolean isSupported(Context context) {
switch (this) {
case WORK_MANAGER:
return WorkManagerAvailableHelper.isWorkManagerApiSupported();
case V_26:
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && isServiceEnabled(context, PlatformJobService.class);
case V_24:
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && isServiceEnabledAndHasPermission(context, PlatformJobService.class, JOB_SCHEDULER_PERMISSION);
case V_21:
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && isServiceEnabledAndHasPermission(context, PlatformJobService.class, JOB_SCHEDULER_PERMISSION);
case V_19:
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && isServiceEnabled(context, PlatformAlarmService.class)
&& isBroadcastEnabled(context, PlatformAlarmReceiver.class);
case V_14:
return JobConfig.isForceAllowApi14()
|| (isServiceEnabled(context, PlatformAlarmService.class) && isServiceEnabled(context, PlatformAlarmServiceExact.class)
&& isBroadcastEnabled(context, PlatformAlarmReceiver.class));
case GCM:
try {
return GcmAvailableHelper.isGcmApiSupported(context);
} catch (Exception e) {
return false;
}
default:
throw new IllegalStateException("not implemented");
}
}