Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
L'API Nearby Messages è un'API di pubblicazione/sottoscrizione che ti consente di trasmettere piccoli payload binari tra dispositivi Android e iOS connessi a internet. I dispositivi non devono necessariamente essere sulla stessa rete, ma devono essere connessi a internet.
Nelle vicinanze utilizza il Bluetooth Low Energy per comunicare un codice di accoppiamento univoco tra i dispositivi. Il server facilita lo scambio di messaggi tra dispositivi che rilevano lo stesso codice di accoppiamento. Quando un dispositivo rileva un codice di accoppiamento da un altro dispositivo nelle vicinanze, lo invia al server di Messaggi nelle vicinanze per la convalida e per verificare se ci sono messaggi da inviare per l'attuale insieme di iscrizioni dell'applicazione.
Messaggi nelle vicinanze non è autenticato e non richiede un Account Google.
Il meccanismo esatto per lo scambio di dati può variare da una versione all'altra. La
seguente sequenza mostra gli eventi che portano allo scambio di messaggi:
Un'app di pubblicazione invia una richiesta per associare un payload binario (il messaggio)
con un codice di accoppiamento univoco nel tempo (token). Il server effettua un'associazione temporanea tra il payload del messaggio e il token.
Il dispositivo di pubblicazione utilizza il Bluetooth Low Energy per rendere il token rilevabile
dai dispositivi nelle vicinanze. Il dispositivo di pubblicazione utilizza anche il Bluetooth Low Energy per cercare i token di altri dispositivi.
Un'app che si iscrive associa il proprio abbonamento a un token e utilizza Bluetooth Low Energy per inviare il token all'editore e rilevare il token dell'editore.
Quando una delle due parti rileva il token dell'altra, lo segnala al server.
Il server facilita lo scambio di messaggi tra due dispositivi quando entrambi sono associati a un token comune e le chiavi API utilizzate dalle app chiamanti sono associate allo stesso progetto in Google Developers Console.
Quando utilizzi l'SDK Nearby di Google Play Services, vengono raccolti dati e analisi sull'utilizzo per migliorare l'esperienza.
Metriche sul rendimento: la durata delle pubblicazioni e delle iscrizioni e il numero di messaggi ricevuti vengono raccolti quando si utilizza l'SDK Nearby.
Informazioni sul dispositivo: il modello di dispositivo, il paese, la versione build e il nome del pacchetto dell'applicazione vengono raccolti e associati alle metriche sul rendimento per identificare segmenti regionali e specifici per dispositivo.
Nearby Messages pubblica: i dati pubblicati tramite Nearby Messages vengono memorizzati da Google finché il messaggio non viene più pubblicato. Questi dati vengono condivisi con gli abbonati nelle vicinanze del dispositivo.
Gli utenti finali possono consentire o negare questa raccolta andando a Impostazioni > Google >
Utilizzo e diagnostica.
[null,null,["Ultimo aggiornamento 2025-08-29 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."]]