[[["わかりやすい","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-07-27 UTC。"],[],[],null,["# Get started\n\nThe Cross device SDK Developer Preview is distributed through an [open-source\nproject](https://github.com/google/cross-device-sdk). This preview is available for the developer community to prototype and\nvalidate multidevice experiences but is not intended for use in production\napplications.\n| **Note:** Quick Share must be turned on to use the Cross device SDK. See [Share files and links with nearby devices](https://support.google.com/android/answer/9286773) to learn more.\n\nSet up Google Play Services\n---------------------------\n\nBefore you start coding,\n[ensure Google Play Services is installed](https://developers.google.com/android/guides/setup#check-whether-installed).\nThe Cross device SDK is in Developer Preview and is available only through the\nGoogle Play Services Beta Program. See\n[this guide](https://developers.google.com/android/guides/beta-program) on how\nto enroll in the Beta Program.\n\nOnce you enroll in the Beta Program and install the appropriate beta version of\nGoogle Play Services, you're ready to begin developing multidevice experiences\nwith the Cross device SDK.\n\nDependencies and permissions\n----------------------------\n\nFirst, open your app module `build.gradle` file and add a dependency on the\nCross device SDK as follows: \n\n dependencies {\n implementation 'com.google.ambient.crossdevice:crossdevice:0.1.0-preview01'\n }\n\nDuring Developer Preview, the API is subject to change, so check release notes\nregularly to ensure you're using the latest version of the Cross device SDK.\n\nOne of the benefits of using the Cross device SDK is that it abstracts away\nlocal discovery, such as `BLUETOOTH_CONNECT`, `BLUETOOTH_SCAN`, and\n`ACCESS_FINE_LOCATION`.\n| **Note:** You still have to declare and request runtime permissions required by your app features and API outside of the Cross device SDK. For instance, you might need `BLUETOOTH_SCAN` permission to perform a Bluetooth scan outside of the Cross device SDK.\n\nCross device APIs\n-----------------\n\nEach API in the Cross device SDK is aimed at solving a common task within a\nmultidevice framework:\n\n- Device discovery: Easily find nearby devices, authorize peer-to-peer communication, and start the target application on the receiving device.\n- Secure communications: Enable encrypted, low-latency, bi-directional data sharing between authorized devices.\n- Multidevice sessions: Transfer or extend an application's user-experience across devices.\n\nThese APIs are available through the `Discovery` and `Sessions` classes: \n\n### Kotlin\n\n```kotlin\nval discovery = Discovery.create(context)\nval sessions = Sessions.create(context)\n```\n\n### Java\n\n```java\nDiscovery discovery = Discovery.create(context);\nSessions sessions = Sessions.create(context);\n```\n\nYou can learn more about the specific uses of these APIs in the following\nsections, or refer to our\n[sample app repository](https://github.com/android/connectivity-samples).\n| **Note:** The Cross device SDK is asynchronous by design. If you are unfamiliar with asynchronous operations, we encourage you to learn about [`Coroutines`](https://kotlinlang.org/docs/coroutines-guide.html) for Kotlin or [`ListenableFuture`](https://developer.android.com/guide/background/listenablefuture) for Java.\n\nSample Applications\n-------------------\n\nWe've prepared a number of apps to demonstrate the Cross device SDK in action.\nThese sample apps are built around a simple Rock, Paper, Scissors game as an\nintuitive and interactive way to familiarize yourself with the APIs. We\nencourage you to explore and modify the sample code to see how to use:\n\n- Device Discovery\n- Secure Connections\n- Sessions Transfer\n- Shared Sessions\n\nCheck out\n[Cross-device Rock, Paper, Scissors on Github](https://github.com/android/connectivity-samples/tree/main/CrossDeviceRockPaperScissors)."]]