/** * @return If {@code true}, then the job should only run if the battery isn't low. */ public boolean requiresBatteryNotLow() { return mRequest.requiresBatteryNotLow(); }
@Override protected JobInfo.Builder createBaseBuilder(JobRequest request, boolean allowPersisting) { return super.createBaseBuilder(request, allowPersisting) .setRequiresBatteryNotLow(request.requiresBatteryNotLow()) .setRequiresStorageNotLow(request.requiresStorageNotLow()); }
/** * @return Whether any of the requirements is different than the default value. */ public boolean hasRequirements() { return requiresCharging() || requiresDeviceIdle() || requiresBatteryNotLow() || requiresStorageNotLow() || requiredNetworkType() != DEFAULT_NETWORK_TYPE; }
/** * @return Whether the battery not low requirement is met. That's true either if it's not a requirement * or if the battery actually isn't low. The battery is low, if less than 15% are left and the device isn't * charging. */ protected boolean isRequirementBatteryNotLowMet() { return !(getParams().getRequest().requiresBatteryNotLow() && Device.getBatteryStatus(getContext()).isBatteryLow()); }
private static Constraints buildConstraints(JobRequest request) { Constraints.Builder constraintsBuilder = new Constraints.Builder() .setRequiresBatteryNotLow(request.requiresBatteryNotLow()) .setRequiresCharging(request.requiresCharging()) .setRequiresStorageNotLow(request.requiresStorageNotLow()) .setRequiredNetworkType(mapNetworkType(request.requiredNetworkType())); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { constraintsBuilder.setRequiresDeviceIdle(request.requiresDeviceIdle()); } return constraintsBuilder.build(); }
/** * @return If {@code true}, then the job should only run if the battery isn't low. */ public boolean requiresBatteryNotLow() { return mRequest.requiresBatteryNotLow(); }
/** * @return Whether any of the requirements is different than the default value. */ public boolean hasRequirements() { return requiresCharging() || requiresDeviceIdle() || requiresBatteryNotLow() || requiresStorageNotLow() || requiredNetworkType() != DEFAULT_NETWORK_TYPE; }
@Override protected JobInfo.Builder createBaseBuilder(JobRequest request, boolean allowPersisting) { return super.createBaseBuilder(request, allowPersisting) .setRequiresBatteryNotLow(request.requiresBatteryNotLow()) .setRequiresStorageNotLow(request.requiresStorageNotLow()); }
/** * @return Whether the battery not low requirement is met. That's true either if it's not a requirement * or if the battery actually isn't low. The battery is low, if less than 15% are left and the device isn't * charging. */ protected boolean isRequirementBatteryNotLowMet() { return !(getParams().getRequest().requiresBatteryNotLow() && Device.getBatteryStatus(getContext()).isBatteryLow()); }