LaunchUtils

Added in 1.0.0-alpha07

public final class LaunchUtils


Summary

Public methods

static final @NonNull Bundle

Returns a Bundle with the necessary entries to request that a new Activity be launched directly into Full Space Mode.

static final @NonNull Bundle

Returns a Bundle with the necessary entries to request that a new Activity be launched directly into Full Space Mode while inheriting the environment from the launching activity.

Public methods

createBundleForFullSpaceModeLaunch

public static final @NonNull Bundle createBundleForFullSpaceModeLaunch(
    @NonNull Session session,
    @NonNull Bundle bundle
)

Returns a Bundle with the necessary entries to request that a new Activity be launched directly into Full Space Mode.

Use Activity.startActivity with the returned bundle to launch an Activity directly into Full Space Mode. Use bundles returned by android.app.ActivityOptions.toBundle or androidx.core.app.ActivityOptionsCompat.toBundle as arguments to this function to preserve the existing options.

The provided bundle must have the android.content.Intent.FLAG_ACTIVITY_NEW_TASK set.

The launch request will not be honored if it is not started from a focused Activity context or if the androidx.xr.runtime.manifest.PROPERTY_XR_ACTIVITY_START_MODE manifest property is set to a value other than androidx.xr.runtime.manifest.XR_ACTIVITY_START_MODE_UNDEFINED for the activity being launched.

Parameters
@NonNull Session session

the session from which to access the XR runtime resources.

@NonNull Bundle bundle

the input bundle to copy its values from.

Returns
@NonNull Bundle

a new bundle with values from the input bundle and the Full Space Mode launch configuration set.

createBundleForFullSpaceModeLaunchWithEnvironmentInherited

public static final @NonNull Bundle createBundleForFullSpaceModeLaunchWithEnvironmentInherited(
    @NonNull Session session,
    @NonNull Bundle bundle
)

Returns a Bundle with the necessary entries to request that a new Activity be launched directly into Full Space Mode while inheriting the environment from the launching activity.

Use Activity.startActivity with the returned bundle to launch an Activity directly into Full Space Mode while inheriting the existing environment. Use bundles returned by android.app.ActivityOptions.toBundle or androidx.core.app.ActivityOptionsCompat.toBundle as arguments to this function to preserve the existing options.

When launched, the Activity will be in Full Space Mode and will inherit the environment from the launching activity. If the inherited environment needs to be animated, the launching activity has to continue updating the environment even after the activity is put into the stopped state.

The provided bundle must have the android.content.Intent.FLAG_ACTIVITY_NEW_TASK set.

The launch request will not be honored if it is not started from a focused Activity context or if the androidx.xr.runtime.manifest.PROPERTY_XR_ACTIVITY_START_MODE manifest property is set to a value other than androidx.xr.runtime.manifest.XR_ACTIVITY_START_MODE_UNDEFINED for the activity being launched.

For security reasons, Z-testing for the new activity is disabled, and the activity is always drawn on top of the inherited environment. Because Z-testing is disabled, the activity should not spatialize itself.

Parameters
@NonNull Session session

the session from which to access the XR runtime resources.

@NonNull Bundle bundle

the input bundle to copy its values from.

Returns
@NonNull Bundle

a new bundle with values from the input bundle and the Full Space Mode with Environment Inheritance launch configuration set.