Use the activity starting state

This page describes the purpose of the ActivityStartingState and how to set and retrieve it from the Google Meet Add-ons SDK.

Overview of the activity starting state

When an add-on is first opened, the side-panel iframe loads the URL specified in the add-on manifest. This initial state might be different from the starting state that the add-on wants to use when users are joining using the activity invite. The ActivityStartingState can be used to specify the iframe URLs that should be loaded when users join using the activity invite. Also, the additional_data property can be utilized by the add-on to store any data it might need for its initialization.

Set and get the activity starting state

You can manage the activity starting state with the following methods.

Set

To set or update information about the ActivityStartingState, use the setActivityStartingState() method. The add-on can set the starting state any time before or during the activity.

The URLs specified in the setActivityStartingState() method must belong to the same origin as the origins specified in the add-on manifest. For more information, see Add-on security.

The sidePanelUrl property, mainStageUrl property, and additionalData property character lengths must conform to their respective size limits as published in the SDK reference docs.

    mainStageClient.setActivityStartingState({
        sidePanelUrl: "https://app.example.com/sidepanel",
        mainStageUrl: "https://app.example.com/mainstage",
        additionalData: JSON.stringify({
        // State to send to participants.
        })
    });

Get

For information on ActivityStartingState, use the getActivityStartingState() method.

    const startingState = mainStageClient.getActivityStartingState();
    const additionalData = JSON.parse(startingState.additionalData);