Package 

Class ScanJob

  • All Implemented Interfaces:
    android.content.ComponentCallbacks , android.content.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.

    • Method Summary

      Modifier and Type Method Description
      boolean onStartJob(JobParameters jobParameters)
      boolean onStopJob(JobParameters params)
      static void setOverrideImmediateScanJobId(int id) Allows configuration of the job id for the Android Job Scheduler.
      static void setOverridePeriodicScanJobId(int id) Allows configuration of the job id for the Android Job Scheduler.
      static int getImmediateScanJobId(Context context) Returns the job id to be used to schedule this job.
      static int getPeriodicScanJobId(Context context) Returns the job id to be used to schedule this job.
      • Methods inherited from class android.app.job.JobService

        jobFinished, onBind
      • Methods inherited from class android.app.Service

        getApplication, getForegroundServiceType, onConfigurationChanged, onCreate, onDestroy, onLowMemory, onRebind, onStart, onStartCommand, onTaskRemoved, onTrimMemory, onUnbind, startForeground, stopForeground, stopSelf, stopSelfResult
      • Methods inherited from class android.content.ContextWrapper

        bindIsolatedService, bindService, bindServiceAsUser, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkSelfPermission, checkUriPermission, clearWallpaper, createAttributionContext, createConfigurationContext, createContextForSplit, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, createWindowContext, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getAttributionTag, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDataDir, getDatabasePath, getDir, getDisplay, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFileStreamPath, getFilesDir, getMainExecutor, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getOpPackageName, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getSystemService, getSystemServiceName, getTheme, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isDeviceProtectedStorage, isRestricted, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, peekWallpaper, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, sendBroadcast, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setTheme, setWallpaper, startActivities, startActivity, startForegroundService, startInstrumentation, startIntentSender, startService, stopService, unbindService, unregisterReceiver, updateServiceGroup
      • Methods inherited from class android.content.Context

        getColor, getColorStateList, getDrawable, getString, getSystemService, getText, obtainStyledAttributes, registerComponentCallbacks, sendBroadcastWithMultiplePermissions, unregisterComponentCallbacks
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • setOverrideImmediateScanJobId

         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

         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

         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
      • getPeriodicScanJobId

         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