Class BGTaskScheduler

  • All Implemented Interfaces:
    NSObject

    public class BGTaskScheduler
    extends NSObject
    A class for scheduling task requests that launch your app in the background. Background tasks give your app a way to run code while the app is suspended. To learn how to register, schedule, and run a background task, see . API-Since: 13.0
    • Constructor Detail

      • BGTaskScheduler

        protected BGTaskScheduler​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static BGTaskScheduler allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(@NotNull
                                                                   @NotNull java.lang.String key)
      • cancelAllTaskRequests

        public void cancelAllTaskRequests()
        Cancel all scheduled task requests.
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(@NotNull
                                                                   @NotNull java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(@NotNull
                                                                                 @NotNull java.lang.Object aTarget,
                                                                                 @NotNull
                                                                                 @NotNull org.moe.natj.objc.SEL aSelector,
                                                                                 @Nullable
                                                                                 @Nullable java.lang.Object anArgument)
      • cancelTaskRequestWithIdentifier

        public void cancelTaskRequestWithIdentifier​(@NotNull
                                                    @NotNull java.lang.String identifier)
        Cancel a previously scheduled task request. - Parameters: - identifier: The string identifier of the task request to cancel.
      • classFallbacksForKeyedArchiver

        @NotNull
        public static @NotNull NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        @NotNull
        public static @NotNull org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • getPendingTaskRequestsWithCompletionHandler

        public void getPendingTaskRequestsWithCompletionHandler​(@NotNull
                                                                @NotNull BGTaskScheduler.Block_getPendingTaskRequestsWithCompletionHandler completionHandler)
        Request a list of unexecuted scheduled task requests. - Parameters: - completionHandler: The completion handler called with the pending tasks. The handler may execute on a background thread. The handler takes a single parameter `tasksRequests`, an array of `BGTaskRequest` objects. The array is empty if there are no scheduled tasks. The objects passed in the array are copies of the existing requests. Changing the attributes of a request has no effect. To change the attributes submit a new task request using ``BGTaskScheduler/submitTaskRequest:error:``.
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        @NotNull
        public static @NotNull NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(@NotNull
                                                                                             @NotNull java.lang.String key)
      • registerForTaskWithIdentifierUsingQueueLaunchHandler

        public boolean registerForTaskWithIdentifierUsingQueueLaunchHandler​(@NotNull
                                                                            @NotNull java.lang.String identifier,
                                                                            @Nullable
                                                                            @Nullable dispatch_queue_t queue,
                                                                            @NotNull
                                                                            @NotNull BGTaskScheduler.Block_registerForTaskWithIdentifierUsingQueueLaunchHandler launchHandler)
        Register a launch handler for the task with the associated identifier that’s executed on the specified queue. Every identifier in the requires a handler. Registration of all launch handlers must be complete before the end of . - Important: Register each task identifier only once. The system kills the app on the second registration of the same task identifier. - Parameters: - identifier: A string containing the identifier of the task. - queue: A queue for executing the task. Pass `nil` to use a default background queue. - launchHandler: The system runs the block of code for the launch handler when it launches the app in the background. The block takes a single parameter, a ``BGTask`` object used for assigning an expiration handler and for setting a completion status. The block has no return value. - Returns: Returns if the launch handler was registered. Returns if the identifier isn't included in the `Info.plist`.
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • sharedScheduler

        @NotNull
        public static @NotNull BGTaskScheduler sharedScheduler()
        The shared background task scheduler instance.
      • submitTaskRequestError

        public boolean submitTaskRequestError​(@NotNull
                                              @NotNull BGTaskRequest taskRequest,
                                              @Nullable
                                              @Nullable org.moe.natj.general.ptr.Ptr<NSError> error)
        Submit a previously registered background task for execution. Submitting a task request for an unexecuted task that’s already in the queue replaces the previous task request. There can be a total of 1 refresh task and 10 processing tasks scheduled at any time. Trying to schedule more tasks returns ``BGTaskSchedulerErrorCode/BGTaskSchedulerErrorCodeTooManyPendingTaskRequests``. - Parameters: - taskRequest: A background task request object specifying the task - error: On input, a pointer to an error object. If an error occurs, this pointer is set to an error object containing the error information. Specify `nil` for this parameter to ignore the error information. identifier and optional configuration information.
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • useStoredAccessor

        @Deprecated
        public static boolean useStoredAccessor()
        Deprecated.