概要
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Nearby Messages API は、インターネットに接続された Android デバイスと iOS デバイス間で小さなバイナリ ペイロードを渡すことができるパブリッシュ / サブスクライブ API です。デバイスは同じネットワークに接続されている必要はありませんが、インターネットに接続されている必要があります。
ニアバイは Bluetooth Low Energy を使用して、デバイス間で一意のペア設定コードを通信します。サーバーは、同じペア設定コードを検出したデバイス間のメッセージ交換を容易にします。デバイスが近くのデバイスからペア設定コードを検出すると、ペア設定コードを Nearby Messages サーバーに送信して検証し、アプリケーションの現在のサブスクリプション セットに配信するメッセージがあるかどうかを確認します。
Nearby Messages は認証されておらず、Google アカウントは必要ありません。
データ交換の正確なメカニズムは、リリースごとに異なる場合があります。次のシーケンスは、メッセージ交換につながるイベントを示しています。
公開アプリは、バイナリ ペイロード(メッセージ)を一時的な一意のペア設定コード(トークン)に関連付けるリクエストを行います。サーバーは、メッセージ ペイロードとトークンを一時的に関連付けます。
公開デバイスは Bluetooth Low Energy を使用して、近くのデバイスがトークンを検出できるようにします。パブリッシュ デバイスは、Bluetooth Low Energy を使用して他のデバイスのトークンをスキャンします。
定期購入アプリは、定期購入をトークンに関連付け、Bluetooth Low Energy を使用してトークンをニュース メディアに送信し、ニュース メディアのトークンを検出します。
どちらかの側が相手のトークンを検出すると、サーバーに報告します。
サーバーは、2 つのデバイスが共通のトークンに関連付けられており、呼び出しアプリで使用される API キーが Google Developers Console の同じプロジェクトに関連付けられている場合に、2 つのデバイス間のメッセージ交換を容易にします。
Google Play 開発者サービスの Nearby SDK を使用すると、ユーザー エクスペリエンスを向上させるために使用状況の分析情報が収集されます。
- パフォーマンス指標: Nearby SDK を使用すると、パブリッシュとサブスクリプションの期間、受信したメッセージの数が収集されます。
- デバイス情報: デバイスのモデル、国、ビルド バージョン、アプリのパッケージ名が収集され、パフォーマンス指標に関連付けられて、地域やデバイス固有のスライスが特定されます。
- Nearby Messages が公開する情報: Nearby Messages を通じて公開されたデータは、メッセージの公開が終了するまで Google によって保存されます。このデータは、デバイスの近くにいるサブスクライバーと共有されます。
エンドユーザーは、[設定] > [Google] > [使用状況と診断情報] に移動して、この収集を許可または拒否できます。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-09-03 UTC。
[null,null,["最終更新日 2025-09-03 UTC。"],[[["\u003cp\u003eNearby Messages, a publish-subscribe API, enables the exchange of small data payloads between nearby Android and iOS devices over the internet using Bluetooth Low Energy.\u003c/p\u003e\n"],["\u003cp\u003eThis API, set to be deprecated in December 2023, is unauthenticated, doesn't require a Google account, and leverages a unique pairing code system for device discovery and message delivery.\u003c/p\u003e\n"],["\u003cp\u003eGoogle collects performance metrics, device information, and published message data to improve the service; however, users can control this data collection through their device settings.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers are encouraged to migrate to Nearby Connections for continued support and functionality.\u003c/p\u003e\n"]]],[],null,["# Overview\n\n| **Warning:** Nearby Messages is deprecated and will stop working as of December 2023. Please migrate to [Nearby Connections](//developers.google.com/nearby/connections/overview) for further support.\n\nThe Nearby Messages API is a publish-subscribe API that lets you pass small\nbinary payloads between internet-connected Android and iOS devices. The devices\ndon't have to be on the same network, but they do have to be connected to the\nInternet.\n\nNearby uses Bluetooth Low Energy to communicate a unique-in-time pairing code\nbetween devices. The server facilitates message exchange between devices that\ndetect the same pairing code. When a device detects a pairing code from a nearby\ndevice, it sends the pairing code to the Nearby Messages server for validation,\nand to check whether there are any messages to deliver for the application's\ncurrent set of subscriptions.\n\nNearby Messages is unauthenticated and does not require a Google Account.\n\nThe exact mechanism for data exchange may vary from release to release. The\nfollowing sequence shows the events leading to message exchange:\n\n1. A publishing app makes a request to associate a binary payload (the message)\n with a unique-in-time pairing code (token). The server makes a temporary\n association between the message payload and the token.\n\n2. The publishing device uses Bluetooth Low Energy to make the token detectable\n by nearby devices. The publishing device also uses Bluetooth Low Energy to scan\n for tokens from other devices.\n\n3. A subscribing app associates its subscription with a token and uses Bluetooth\n Low Energy to send its token to the publisher, and to detect the publisher's\n token.\n\n4. When either side detects the other's token, it reports it to the server.\n\n5. The server facilitates message exchange between two devices when both are\n associated with a common token, and the API keys used by the calling apps are\n associated with the same project in the [Google Developers Console](https://console.developers.google.com/).\n\nWhen using the Google Play services Nearby SDK, usage analytics are collected to\nimprove the experience.\n\n- **Performance metrics:** The duration of publishes and subscriptions and the number of messages received is collected when using the Nearby SDK.\n- **Device information:** Device model, country, build version and the application package name are collected and associated with the performance metrics to identify regional and device-specific slices.\n- **Nearby Messages publishes:** Data published through Nearby Messages is stored by Google until the message is no longer published. This data is shared with subscribers who are near the device.\n\nEnd users can allow or deny this collection by navigating to Settings \\\u003e Google \\\u003e\nUsage \\& diagnostics."]]