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.
On Android, when publishing or subscribing with non-BLE devices, only invoke the Nearby Messages API from an Activity, and only keep that Activity running when the screen is on and your app is in the foreground. To do this, pass the Activity as an argument to the
Context
parameter ofNearby.getMessagesClient()
. Invoking Nearby from a Service is only supported when subscribing to Bluetooth Low Energy (BLE) beacon messages.On Android, in your app's
Activity.onStop()
callback, callNearby.getMessagesClient(Activity).unpublish()
andNearby.getMessagesClient(Activity).unsubscribe()
on any active publishes or subscribes. On iOS no action is necessary as this is handled automatically.Make it easy for the user to stop active publishes and subscribes.
Do not publish or subscribe in the background without the user's knowledge.
Use the right branding
We’ve provided a set of standard assets that you can use to represent Nearby in your app. Use only the following approved icons when referring to Nearby.