Developer Guidelines
Stay organized with collections
Save and categorize content based on your preferences.
The following guidelines will help you to build high quality applications with
the Nearby Messages API and the Nearby Connections API.
Respect user privacy
Help the user understand what data your app will expose to nearby users.
Don't publish sensitive information such as passwords and credit card
numbers. Instead, pass authorization tokens or transaction identifiers.
Require an explicit user-initiated action to start Nearby
Don’t surprise the user. Require the user to perform an explicit action (a
button tap, going to a section in your app, a special switch, etc) to activate
Nearby.
On both iOS and Android, calling Nearby for the first time will trigger a
permission dialog from Nearby. Waiting for an explicit user action before
invoking Nearby will help the user contextualize the dialog and associate it
with your app's proximity-based feature.
Be mindful of battery consumption
Nearby's use of radios and sensors will cause your app to consume battery at
2.5-3.5 times the normal rate. To reduce battery usage, observe the following
recommendations.
Use the right branding
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-12 UTC.
[null,null,["Last updated 2025-08-12 UTC."],[[["\u003cp\u003eBuild high-quality applications with Nearby Messages API and Nearby Connections API by prioritizing user privacy and requiring explicit user action to initiate Nearby features.\u003c/p\u003e\n"],["\u003cp\u003eMinimize battery consumption by invoking Nearby Messages API from an active Android Activity, unsubscribing/unpublishing when the app is stopped, and letting users easily control their Nearby interactions.\u003c/p\u003e\n"],["\u003cp\u003eProtect sensitive user information by avoiding its publication through Nearby and opting for authorization tokens or transaction identifiers instead.\u003c/p\u003e\n"],["\u003cp\u003eAdhere to Nearby's branding guidelines and use the provided standard assets when representing Nearby in your application.\u003c/p\u003e\n"]]],[],null,["# Developer Guidelines\n\nThe following guidelines will help you to build high quality applications with\nthe Nearby Messages API and the Nearby Connections API.\n\nRespect user privacy\n--------------------\n\n- Help the user understand what data your app will expose to nearby users.\n\n- Don't publish sensitive information such as passwords and credit card\n numbers. Instead, pass authorization tokens or transaction identifiers.\n\nRequire an explicit user-initiated action to start Nearby\n---------------------------------------------------------\n\n- Don't surprise the user. Require the user to perform an explicit action (a\n button tap, going to a section in your app, a special switch, etc) to activate\n Nearby.\n\n- On both iOS and Android, calling Nearby for the first time will trigger a\n permission dialog from Nearby. Waiting for an explicit user action before\n invoking Nearby will help the user contextualize the dialog and associate it\n with your app's proximity-based feature.\n\nBe mindful of battery consumption\n---------------------------------\n\nNearby's use of radios and sensors will cause your app to consume battery at\n2.5-3.5 times the normal rate. To reduce battery usage, observe the following\nrecommendations.\n\n- On Android, when publishing or subscribing with non-BLE devices, only invoke\n the Nearby Messages API from an Activity, and only keep that Activity running\n when the screen is on and your app is in the foreground. To do this, pass the\n Activity as an argument to the `Context` parameter of\n [`Nearby.getMessagesClient()`](/android/reference/com/google/android/gms/nearby/messages/MessagesClient).\n Invoking Nearby from a Service is only supported when\n [subscribing to Bluetooth Low Energy (BLE) beacon messages](/nearby/messages/android/get-beacon-messages#subscribe_in_the_background).\n\n- On Android, in your app's [`Activity.onStop()`](http://developer.android.com/reference/android/app/Activity.html#onStop())\n callback, call [`Nearby.getMessagesClient(Activity).unpublish()`](/android/reference/com/google/android/gms/nearby/messages/MessagesClient#unpublish(com.google.android.gms.nearby.messages.Message))\n and [`Nearby.getMessagesClient(Activity).unsubscribe()`](/android/reference/com/google/android/gms/nearby/messages/MessagesClient#unsubscribe(com.google.android.gms.nearby.messages.MessageListener))\n on any active publishes or subscribes.\n On iOS no action is necessary as this is handled automatically.\n\n- Make it easy for the user to stop active publishes and subscribes.\n\n- Do not publish or subscribe in the background without the user's knowledge.\n\nUse the right branding\n----------------------\n\n- We've provided a set of standard assets that you can use to represent Nearby\n in your app. Use only the following approved icons when referring to Nearby.\n\n- [PNG Assets](/static/nearby/downloads/nearby_pngs.zip)\n\n- [SVG Assets](/static/nearby/downloads/nearby_svgs.zip)"]]