BlockingServiceConnection

open class BlockingServiceConnection : ServiceConnection
kotlin.Any
   ↳ androidx.ads.identifier.internal.BlockingServiceConnection

A one-time use ServiceConnection that facilitates waiting for the bind to complete and the passing of the IBinder from the callback thread to the waiting thread.

Summary

Public constructors

A one-time use ServiceConnection that facilitates waiting for the bind to complete and the passing of the IBinder from the callback thread to the waiting thread.

Public methods

open IBinder
getServiceWithTimeout(timeout: Long, @NonNull timeUnit: TimeUnit)

Blocks until the bind is complete with a timeout and returns the bound IBinder.

open Unit
onServiceConnected(@NonNull name: ComponentName, @NonNull service: IBinder)

open Unit

Public constructors

<init>

BlockingServiceConnection()

A one-time use ServiceConnection that facilitates waiting for the bind to complete and the passing of the IBinder from the callback thread to the waiting thread.

Public methods

getServiceWithTimeout

@NonNull open fun getServiceWithTimeout(timeout: Long, @NonNull timeUnit: TimeUnit): IBinder

Blocks until the bind is complete with a timeout and returns the bound IBinder. This must only be called once.

Return
IBinder: the IBinder of the bound service
Exceptions
InterruptedException if the current thread is interrupted while waiting for the bind
IllegalStateException if called more than once
TimeoutException if the timeout period has elapsed

onServiceConnected

open fun onServiceConnected(@NonNull name: ComponentName, @NonNull service: IBinder): Unit

onServiceDisconnected

open fun onServiceDisconnected(@NonNull name: ComponentName): Unit