Batch

class Batch 
: PendingResult 

Handles a batch of PendingResult items. Callbacks can be added and you can block to wait for all items in the batch to complete like any other PendingResult item. A Batch can also be canceled if the results are no longer needed. In this case, the onBatchComplete callback will never be triggered.

The results can be taken either from the underlying PendingResult s or via take but not both.

Summary

Nested types

Builder for Batch objects.

Public functions

R!
await ()

Blocks until the task is completed.

R!
await (time:  Long , units:  TimeUnit !)

Blocks until the task is completed or has timed out waiting for the result.

Unit
cancel ()

Requests that the batch be canceled.

Unit
Boolean

Indicates whether the pending result has been canceled either due to calling disconnect or calling cancel directly on the pending result or an enclosing Batch .

Unit
setResultCallback (callback:  ResultCallback < Any !>?)

Set the callback here if you want the result to be delivered via a callback when the result is ready.

Unit
setResultCallback (
    callback:  ResultCallback < Any !>!,
    time:  Long ,
    units:  TimeUnit !
)

Set the callback here if you want the result to be delivered via a callback when the result is ready or has timed out waiting for the result.

Protected properties

WeakReference < GoogleApiClient !>!

This reference will never be null so long as the GoogleApiClient is connected.

Inherited functions

From com.google.android.gms.common.api.PendingResult
abstract R
await (time:  Long , units:  TimeUnit )

Blocks until the task is completed or has timed out waiting for the result.

abstract Unit
setResultCallback (callback:  ResultCallback < Any !>)

Set the callback here if you want the result to be delivered via a callback when the result is ready.

abstract Unit
setResultCallback (
    callback:  ResultCallback < Any !>,
    time:  Long ,
    units:  TimeUnit
)

Set the callback here if you want the result to be delivered via a callback when the result is ready or has timed out waiting for the result.

TransformedResult <S!>
<S :  Result ?> then (transform:  ResultTransform < Any !, S!>)

Transforms the result by making another API call.

Public functions

await

fun  await 
(): R!

Blocks until the task is completed. This is not allowed on the UI thread. The returned result object can have an additional failure mode of INTERRUPTED .

await

fun  await 
(time:  Long 
, units:  TimeUnit 
!): R!

Blocks until the task is completed or has timed out waiting for the result. This is not allowed on the UI thread. The returned result object can have an additional failure mode of either INTERRUPTED or TIMEOUT .

cancel

fun  cancel 
():  Unit 

Requests that the batch be canceled. Cancels all underlying PendingResult s.

onResult will never be called, await will return a failed result with status CANCELED .

clearResultCallback

fun  clearResultCallback 
():  Unit 

isCanceled

fun  isCanceled 
():  Boolean 

Indicates whether the pending result has been canceled either due to calling disconnect or calling cancel directly on the pending result or an enclosing Batch .

setResultCallback

fun  setResultCallback 
(callback:  ResultCallback 
< Any 
!>?):  Unit 

Set the callback here if you want the result to be delivered via a callback when the result is ready.

setResultCallback

fun  setResultCallback 
(
    callback:  ResultCallback < Any !>!,
    time:  Long ,
    units:  TimeUnit !
):  Unit

Set the callback here if you want the result to be delivered via a callback when the result is ready or has timed out waiting for the result. The returned result object can have an additional failure mode of TIMEOUT .

Protected properties

mApiClient

protected val  mApiClient 
 WeakReference 
< GoogleApiClient 
!>!

This reference will never be null so long as the GoogleApiClient is connected. It needs to be weak so that PendingResults don't pin disconnected GACs due to binder references to the PendingResults.

Create a Mobile Website
View Site in Mobile | Classic
Share by: