Class ScanJob

  • All Implemented Interfaces:
    ComponentCallbacks, ComponentCallbacks2

    public class ScanJob
    extends JobService
    Used to perform scans periodically using the JobScheduler Only one instance of this will be active, even with multiple jobIds. If one job is already running when another is scheduled to start, onStartJob gets called again on the same instance. If the OS decides to create a new instance, it will call onStopJob() on the old instance Created by dyoung on 3/24/17.
    • Constructor Detail

      • ScanJob

        public ScanJob()
    • Method Detail

      • setOverrideImmediateScanJobId

        public static void setOverrideImmediateScanJobId​(int id)
        Allows configuration of the job id for the Android Job Scheduler. If not configured, this will default to the value in the AndroidManifest.xml WARNING: If using this library in a multi-process application, this method may not work. This is considered a private API and may be removed at any time. the preferred way of setting this is in the AndroidManifest.xml as so:
        Parameters:
        id - identifier to give the job
      • setOverridePeriodicScanJobId

        public static void setOverridePeriodicScanJobId​(int id)
        Allows configuration of the job id for the Android Job Scheduler. If not configured, this will default to the value in the AndroidManifest.xml WARNING: If using this library in a multi-process application, this method may not work. This is considered a private API and may be removed at any time. the preferred way of setting this is in the AndroidManifest.xml as so:
        Parameters:
        id - identifier to give the job
      • getImmediateScanJobId

        public static int getImmediateScanJobId​(Context context)
        Returns the job id to be used to schedule this job. This may be set in the AndroidManifest.xml or in single process applications by using #setOverrideJobId
        Parameters:
        context - the application context
        Returns:
        the job id
      • getPeriodicScanJobId

        public static int getPeriodicScanJobId​(Context context)
        Returns the job id to be used to schedule this job. This may be set in the AndroidManifest.xml or in single process applications by using #setOverrideJobId
        Parameters:
        context - the application context
        Returns:
        the job id