활동 전이나 활동 중에 언제든지 setActivityStartingState() 메서드를 호출하여 ActivityStartingState를 설정하거나 업데이트할 수 있습니다. ActivityStartingState이 startActivity() 호출에서만 설정된 경우 setActivityStartingState() 호출을 생략할 수 있습니다.
2단계: 부가기능에서 활동 시작
활동은 부가기능이 MeetSidePanelClient에서 startActivity() 메서드를 호출할 때 시작됩니다.
startActivity() 메서드는 ActivityStartingState 객체를 매개변수로 사용하므로 setActivityStartingState()를 호출하는 대신 startActivity()를 호출할 수 있습니다.
사용자가 콘텐츠 선택을 완료하고 활동을 시작할 준비가 되면 다음과 같이 애드온에서 startActivity() 메서드를 호출합니다.
sidePanelClient.startActivity({mainStageUrl:"https://app.example.com/mainstage",additionalData:JSON.stringify({// State to send to participants.})});
startActivity() 메서드가 호출되면 Meet은 다음 작업을 실행합니다.
기타 참여자: Meet에 활동이 진행 중이라는 알림이 표시됩니다.
시작자: ActivityStartingState에 기본 스테이지 URL이 지정된 경우 Meet에서는 ActivityStartingState의 URL을 사용하여 기본 스테이지를 엽니다.
3단계: 활동 시작 상태 가져오기
사용자가 활동에 참여하면 ActivityStartingState에 따라 기본 스테이지 또는 측면 패널에 부가기능이 로드됩니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-29(UTC)"],[],[],null,["# Collaborate using a Meet add-on\n\nParticipants in a meeting can work collaboratively on a\nGoogle Meet add-on activity. When a collaborative activity starts,\nall participants in the meeting receive a notification that the activity is\nongoing.\n\nThis notification is adapted to the availability and installation status of the\nadd-on:\n\n- **If the participant has the add-on installed**:\n They can join the activity.\n\n- **If the participant doesn't have the add-on\n installed**: They're directed to install the\n add-on.\n\n- **If the add-on isn't available for the\n participant's platform**: They're informed that they can't join the activity\n using their current device.\n\nWhen a user joins the activity they will load their own iframes with your\nadd-on content. You can customize whether new joiners\nshould open the collaborative activity in the main stage or side panel.\n\nStart the activity\n------------------\n\nAn activity is started by calling the\n[`startActivity()`](/workspace/meet/add-ons/reference/websdk/addon_sdk.meetaddonclient.startactivity)\nmethod, which uses the\n[`ActivityStartingState`](/workspace/meet/add-ons/reference/websdk/addon_sdk.activitystartingstate)\ninterface.\n\n### Step 1 (Optional): The add-on sets the activity starting state\n\nThe [`ActivityStartingState`](/workspace/meet/add-ons/reference/websdk/addon_sdk.activitystartingstate)\ncontains information about the initial state of the\nadd-on that's used when the participant accepts the\ninvitation to join the activity.\n\nThe add-on can set or update the\n`ActivityStartingState` by calling the [`setActivityStartingState()`](/workspace/meet/add-ons/reference/websdk/addon_sdk.meetaddonclient.setactivitystartingstate)\nmethod anytime before or during the activity. Calls to\n`setActivityStartingState()` can be omitted if the `ActivityStartingState` is\nexclusively set in the call to `startActivity()`.\n\n### Step 2: The add-on starts the activity\n\nThe activity begins when the add-on calls the\n[`startActivity()`](/workspace/meet/add-ons/reference/websdk/addon_sdk.meetaddonclient.startactivity)\nmethod on the [`MeetSidePanelClient`](/workspace/meet/add-ons/reference/websdk/addon_sdk.meetsidepanelclient).\nThe `startActivity()` method takes an `ActivityStartingState` object as a\nparameter, so `startActivity()` can be called instead of calling\n`setActivityStartingState()`.\n\nOnce the user completes the content selection and is ready to start an activity,\ncall the `startActivity()` method in your add-on as\nfollows: \n\n sidePanelClient.startActivity({\n mainStageUrl: \"https://app.example.com/mainstage\",\n additionalData: JSON.stringify({\n // State to send to participants.\n })\n });\n\nWhen `startActivity()` method is invoked, Meet performs the\nfollowing actions:\n\n- **For other participants**: Meet shows a notification that\n the activity is ongoing.\n\n- **For the initiator** : If a main stage URL was specified in the\n `ActivityStartingState`, Meet opens the main stage using\n the URL from the `ActivityStartingState`.\n\n### Step 3: Get the activity starting state\n\nWhen a user joins the activity, they load your add-on\ninto the main stage or side panel depending on the `ActivityStartingState`.\n\nWith the `additionalData` property, you can share initial data (also referred to\nas state) with users joining the activity. After [initializing a\n`MainStageClient` or `SidePanelClient`](/workspace/meet/add-ons/guides/get-client), you\ncan call the\n[`getActivityStartingState()`](/workspace/meet/add-ons/reference/websdk/addon_sdk.meetaddonclient.getactivitystartingstate)\nmethod to retrieve the `additionalData` property. \n\n const startingState = client.getActivityStartingState();\n const additionalData = JSON.parse(startingState.additionalData);\n\n### Step 4 (Optional): Share add-on state in an activity\n\nYou may also share state between users while the activity is ongoing. You can\nshare state in two ways:\n\n- Handle it yourself by authoring your own synchronization backend.\n- Use the [Co-Doing API](/workspace/meet/add-ons/guides/use-CoDoingAPI), which is a convenient and fast way to share arbitrary data between users.\n\nExample: Animation add-on on GitHub\n-----------------------------------\n\nThe [\"Animation\" sample add-on on GitHub](https://github.com/googleworkspace/meet/tree/3311b735550b8927c8b7ef2c6d06f768d9fe0476/addons-web-sdk/samples/animation-next-js)\nincludes collaboration in an add-on. [Step 1](#set-state)\nfrom this guide is not included in the sample. Instead, when the\nadd-on initiator clicks the\n[\"Start the Animation\" button](https://github.com/googleworkspace/meet/blob/3311b735550b8927c8b7ef2c6d06f768d9fe0476/addons-web-sdk/samples/animation-next-js/src/app/sidepanel/page.tsx#L72)\nin the side panel, the `startActivity()` method is called ([Step 2](#start-add-on-activity))\nby populating the starting state with the user's selected color. After the\nactivity starts, the main stage retrieves the starting state by\n[calling the `getActivityStartingState()` method](https://github.com/googleworkspace/meet/blob/3311b735550b8927c8b7ef2c6d06f768d9fe0476/addons-web-sdk/samples/animation-next-js/src/app/mainstage/page.tsx#L34)\n([Step 3](#get-state)). [Step 4](#share-state) is omitted, as state (the\nselected color) is not shared between participants during the activity in this\nsample add-on. Individual users can, however, change\ntheir own state by selecting a color, which is sent from the side panel frame to\nthe main stage frame using [frame-to-frame messaging](/workspace/meet/add-ons/guides/frame-to-frame-messaging).\n\nConstraints\n-----------\n\n- The URLs specified in the `ActivityStartingState` must belong to the same [origin](/workspace/meet/add-ons/guides/overview#origin) as the origins specified in the [add-on manifest](/workspace/meet/add-ons/guides/deploy-add-on#create-deployment). For more information, see [Add-on security](/workspace/meet/add-ons/guides/add-on-security).\n- The [`sidePanelUrl`](/workspace/meet/add-ons/reference/websdk/addon_sdk.activitystartingstate.sidepanelurl) property, [`mainStageUrl`](/workspace/meet/add-ons/reference/websdk/addon_sdk.activitystartingstate.mainstageurl) property, and [`additionalData`](/workspace/meet/add-ons/reference/websdk/addon_sdk.activitystartingstate.additionaldata) property character lengths must conform to their respective size limits as published in the SDK reference docs.\n\nRelated topics\n--------------\n\n- [Use the activity starting state](/workspace/meet/add-ons/guides/activity-starting-state)\n- [Use a Meet add-on](/workspace/meet/add-ons/guides/use-add-on)\n- [Implement the Co-Doing API](/workspace/meet/add-ons/guides/use-CoDoingAPI)\n- [Add-on security](/workspace/meet/add-ons/guides/add-on-security)"]]