Pro Android with Kotlin


Download 5.42 Mb.
Pdf ko'rish
bet117/223
Sana04.11.2023
Hajmi5.42 Mb.
#1746807
1   ...   113   114   115   116   117   118   119   120   ...   223
Bog'liq
@de android telegram Pro Android with Kotlin Developing Modern Mobile

132
CHAPTER 8: APIs
Table 8-2. JobInfo Builder Options
Method
Description
setMinimumLatency 
(minLatencyMillis: Long)
This job should be delayed by the specified amount of time, 
or longer.
setOverrideDeadline(maxExecution 
DelayMillis: Long)
This is the maximum time a job can be delayed.
setPeriodic(intervalMillis: Long)
This makes the job repeating and sets a recurrence interval. 
The actual interval can be higher but will not be lower.
setPeriodic(intervalMillis: Long, 
flexMillis: Long)
This makes the job repeating and sets a recurrence 
interval and a flexibility window. So, the real interval 
will be between intervalMillis − 0.5 flexMillis and 
intervalMillis + 0.5 flexMillis. Both numbers get their 
lowest possible value clamped to getMinPeriodMillis() 
and MAX( getMinFlexMillis(), 0.05 * intervalMillis ), 
respectively.
setBackoffCriteria(initial 
BackoffMillis:Long, 
backoffPolicy:Int)
A back-off might happen when inside your job 
implementation you write jobFinished(params, true). Here 
you specify what happens in such a case. Possible values 
for backoffPolicy are given by the constants in the following:
• JobInfo.BACKOFF_POLICY_LINEAR: Back-offs happen at 
intervals of initialBackoffMillis retry − number.
• JobInfo.BACKOFF_POLICY_EXPONENTIAL: Backoffs happen 
at intervals of initialBackoffMillis
2
retry−number
.
setExtras(extras: 
PersistableBundle)
This sets optional extras. These extras get passed to 
onStartJob() inside the job implementation.
setTransientExtras(extras: Bundle) This is only for API level 26 and higher. This sets optional 
unpersisted extras. These extras get passed to onStartJob() 
inside the job implementation.
setPersisted(isPersisted: Boolean) This sets whether the job gets persisted across device 
reboots. It needs the permission android.Manifest.
permission.RECEIVE_BOOT_COMPLETED.
setRequiredNetworkType(networkTy
pe: Int)
This specifies an additional condition that needs to be met 
for the job to run. These are possible argument values:
• JobInfo.NETWORK_TYPE_NONE
• JobInfo.NETWORK_TYPE_ANY
• JobInfo.NETWORK_TYPE_UNMETERED
• JobInfo.NETWORK_TYPE_NOT_ROAMING
• JobInfo.NETWORK_TYPE_METERED
(continued)



Download 5.42 Mb.

Do'stlaringiz bilan baham:
1   ...   113   114   115   116   117   118   119   120   ...   223




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling