Picker API 시작하기
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
Picker API는 사용자가 Google 포토 라이브러리에서 사진과 동영상을 선택하고 애플리케이션과 공유할 수 있는 안전한 방법을 제공합니다.
시작하기 전에
Picker API 흐름
다음은 Picker API의 작동 방식에 대한 개요입니다.
OAuth 토큰 확인: Picker API 흐름을 시작하기 전에 사용자의 유효한 OAuth 2.0 액세스 토큰을 확인합니다. 토큰이 없으면 OAuth 2.0 승인 흐름을 시작하여 토큰을 가져옵니다.
세션 만들기: Picker API를 호출하여 새 세션을 만들고 프로세스를 시작합니다. 이 호출은 고유한 pickerUri
를 반환합니다.
사용자를 Google 포토 앱으로 안내: 사용자에게 pickerUri
를 제공합니다 (클릭 가능한 링크 또는 QR 코드로 제공). 이 URL을 사용하면 Google 포토 앱이 안전하게 열립니다.
사용자가 미디어 항목을 선택합니다. 사용자는 Google 포토 앱 내에서 라이브러리를 둘러보고 앱과 공유할 사진과 동영상을 선택할 수 있습니다. 사용자의 선택 환경 개요를 읽어보세요.
세션 폴링: 앱은 주기적으로 세션을 폴링하여 상태를 확인해야 합니다. 사용자가 선택을 완료했음을 나타내는 true를 반환하는 mediaItemsSet
속성을 찾습니다.
선택한 미디어 항목 나열: mediaItemsSet
가 true를 반환하면 목록 메서드를 사용하여 선택된 미디어 항목에 관한 세부정보를 가져올 수 있습니다.
미디어 항목 검색 및 사용: 이제 선택한 미디어 항목에 액세스할 수 있습니다. baseUrl
를 사용하여 콘텐츠를 가져오고 애플리케이션 내에서 활용할 수 있습니다.
다음 단계
- 참조 문서 검토: 사용 가능한 모든 메서드와 매개변수에 대해 알아보려면 자세한 Picker API 참조 문서를 살펴보세요.
- 샘플 사용해 보기: 샘플을 확인하여 Picker API가 작동하는 모습을 보고 통합에 대한 아이디어를 얻으세요.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-29(UTC)
[null,null,["최종 업데이트: 2025-08-29(UTC)"],[[["\u003cp\u003eThe Picker API lets users securely select photos and videos from their Google Photos library and share them with your application.\u003c/p\u003e\n"],["\u003cp\u003eBefore using the Picker API, ensure it's the right fit for your use case and properly configure your app with the necessary API and authentication setup.\u003c/p\u003e\n"],["\u003cp\u003eThe Picker API flow involves creating a session, directing users to the Google Photos app for selection, polling the session for completion, and then retrieving the selected media items.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers should check the provided resources like reference documentation and samples for detailed information and implementation examples.\u003c/p\u003e\n"]]],["The Picker API enables users to share media from Google Photos with your app. First, check for and obtain an OAuth token. Then, create a new session via the Picker API, generating a `pickerUri`. Direct users to this URI to select media. Periodically poll the session until `mediaItemsSet` is true. Use the list method to retrieve details of selected items, and then access their content using `baseUrl` for use in your application.\n"],null,["# Get started with the Picker API\n\nThe Picker API provides a secure way for your users to select photos and videos\nfrom their Google Photos library and share them with your application.\n\nBefore you start\n----------------\n\n- **Check out the overview:** [Compare the Picker API and the Library API](/photos/overview/about) to make sure the Picker API is the right fit for your use case.\n- **Configure your app:** Enable the API and set up authentication. See [Configure your app](/photos/overview/configure-your-app) for detailed steps.\n\nThe Picker API flow\n-------------------\n\nHere is an overview of the how the Picker API works:\n\n1. **Check for OAuth token:** Before starting the Picker API flow, check for a\n valid OAuth 2.0 access token for the user. If there is no token, [initiate\n the OAuth 2.0 authorization flow](/identity/protocols/oauth2) to obtain one.\n\n2. **Create a session:** Initiate the process by making a call to the Picker\n API to [create a new\n session](/photos/picker/reference/rest/v1/sessions/create). This call will\n return a unique `pickerUri`.\n\n3. **Direct users to the Google Photos app:** Provide the [`pickerUri`](/photos/picker/reference/rest/v1/sessions#PickingSession.FIELDS.picker_uri)\n to your users (either as a clickable link or a QR code). This URL will\n securely open their Google Photos app.\n\n4. **User selects media items:** Within the Google Photos app, users can browse\n their library and select the photos and videos they want to share with your\n app. Read an overview of the [user's picking experience](/photos/picker/guides/picking-experience).\n\n5. **Poll the session:** Your app should periodically [poll the session](/photos/picker/reference/rest/v1/sessions/get)\n to check the status. You're looking for the\n [`mediaItemsSet`](/photos/picker/reference/rest/v1/sessions#PickingSession.FIELDS.media_items_set)\n property to return true, indicating the user has finished their selection.\n\n | **Note:** Every time you poll a session the response contains [recommended\n | intervals and\n | timeouts](/photos/picker/reference/rest/v1/sessions#PollingConfig) to configure your polling.\n6. **List selected media items:** Once `mediaItemsSet` returns true, you can\n use [the list method](/photos/picker/reference/rest/v1/mediaItems/list) to\n get details about the selected media items.\n\n7. **Retrieve and use media items:** Now you have access to the selected media\n items. You can [fetch their\n content](/photos/picker/guides/media-items#retrieve-picked-media-items)\n using the\n [`baseUrl`](/photos/picker/reference/rest/v1/mediaItems#MediaFile.FIELDS.base_url)\n and utilize them within your application.\n\nNext steps\n----------\n\n- Review the reference docs: Explore the detailed [Picker API reference\n documentation](/photos/picker/reference/rest) to learn about all the available methods and parameters.\n- Try out the samples: Check out our [sample](/photos/picker/samples) to see the Picker API in action and get inspiration for your integration."]]