interface AgeSignalManager


Query the age signal of the current device user.

Obtain an instance via AgeSignalManager.create.

Summary

Public companion functions

AgeSignalManager
create(context: Context)

Creates an AgeSignalManager instance associated with the given context.

Public functions

open suspend GetAgeRangeResponse
getAgeRange(context: Context, request: GetAgeRangeRequest)

Requests the user's age range.

Unit
getAgeRangeAsync(
    context: Context,
    request: GetAgeRangeRequest,
    cancellationSignal: CancellationSignal?,
    executor: Executor,
    callback: OutcomeReceiverCompat<GetAgeRangeResponse, GetAgeRangeException>
)

Requests the user's age range.

Public companion functions

create

Added in 1.0.0-alpha01
fun create(context: Context): AgeSignalManager

Creates an AgeSignalManager instance associated with the given context.

Parameters
context: Context

the context to associate with this manager

Returns
AgeSignalManager

a concrete AgeSignalManager

Public functions

getAgeRange

open suspend fun getAgeRange(context: Context, request: GetAgeRangeRequest): GetAgeRangeResponse

Requests the user's age range.

The execution can potentially launch UI flows to collect user consent to sharing their age range.

Parameters
context: Context

the android.app.Activity context used to launch any UI needed

request: GetAgeRangeRequest

the request for getting the user's age range

Throws
GetAgeRangeException

if the request fails

getAgeRangeAsync

Added in 1.0.0-alpha01
fun getAgeRangeAsync(
    context: Context,
    request: GetAgeRangeRequest,
    cancellationSignal: CancellationSignal?,
    executor: Executor,
    callback: OutcomeReceiverCompat<GetAgeRangeResponse, GetAgeRangeException>
): Unit

Requests the user's age range.

This API uses callbacks instead of Kotlin coroutines.

The execution can potentially launch UI flows to collect user consent to sharing their age range.

Parameters
context: Context

the android.app.Activity context used to launch any UI needed

request: GetAgeRangeRequest

the request for getting the user's age range

cancellationSignal: CancellationSignal?

an optional signal that allows for cancelling this call

executor: Executor

the callback will take place on this executor

callback: OutcomeReceiverCompat<GetAgeRangeResponse, GetAgeRangeException>

the callback invoked when the request succeeds or fails