ProjectedActivityCompat


@ExperimentalProjectedApi
public final class ProjectedActivityCompat implements AutoCloseable


Class providing Projected device-specific features for Activity, like listening to Projected input events.

Use create to create an instance of this class. Use close to clear the instance.

Summary

Public methods

void
static final @NonNull ProjectedActivityCompat
@RequiresApi(value = 34)
create(@NonNull Activity activity)

Connects to the service providing features for Projected devices and returns the ProjectedActivityCompat when the connection is established.

static final @NonNull ProjectedActivityCompat

This method is deprecated. Use create(activity: Activity) instead

final @NonNull Flow<@NonNull ProjectedInputEvent>

Flow providing a stream of Projected input events.

Public methods

close

Added in 1.0.0-alpha06
public void close()

create

@RequiresApi(value = 34)
public static final @NonNull ProjectedActivityCompat create(@NonNull Activity activity)

Connects to the service providing features for Projected devices and returns the ProjectedActivityCompat when the connection is established.

Parameters
@NonNull Activity activity

The Activity running on a Projected device

Throws
IllegalStateException

if the projected service is not found or binding is not permitted

IllegalArgumentException

if provided Activity is not running on a Projected device

create

public static final @NonNull ProjectedActivityCompat create(@NonNull Context context)

Connects to the service providing features for Projected devices and returns the ProjectedActivityCompat when the connection is established.

Use ProjectedActivityCompat.create(activity: Activity) instead

TODO(b/479214966): Remove this once all clients have been migrated.

Parameters
@NonNull Context context

The context to use for binding to the service.

Throws
IllegalStateException

if the projected service is not found or binding is not permitted

getProjectedInputEvents

Added in 1.0.0-alpha06
public final @NonNull Flow<@NonNull ProjectedInputEventgetProjectedInputEvents()

Flow providing a stream of Projected input events.