Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Die Nearby Messages API kann aufgrund der Art und Weise, wie Bluetooth und andere Geräteressourcen zum Erkennen und Kommunizieren mit Geräten in der Nähe verwendet werden, akkuintensiv sein. Damit Nutzer die Kontrolle über die Nutzung haben, wird beim ersten Zugriff auf die Nearby Messages API ein Einwilligungsdialogfeld angezeigt.
Der Nutzer muss Nearby erlauben, die erforderlichen Geräteressourcen zu nutzen.
Nur BLE
Sie können das Dialogfeld zur Einwilligung vermeiden, wenn Ihrer App die Berechtigung „ACCESS_FINE_LOCATION“ gewährt wurde und BLE nur bei Veröffentlichungen und Abos verwendet wird.
[null,null,["Zuletzt aktualisiert: 2025-08-29 (UTC)."],[[["\u003cp\u003eThe Nearby Messages API requires user consent to utilize device resources due to potential battery consumption from Bluetooth and other resource usage.\u003c/p\u003e\n"],["\u003cp\u003eAn opt-in dialog is presented upon first API access, requiring explicit user permission.\u003c/p\u003e\n"],["\u003cp\u003eThe opt-in dialog can be bypassed if the app only uses Bluetooth Low Energy (BLE), has been granted ACCESS_FINE_LOCATION permission, and is configured with the NearbyPermissions.BLE option.\u003c/p\u003e\n"]]],[],null,["# Handling User Consent\n\nThe Nearby Messages API has the potential to be battery-intensive due to the way\nit uses Bluetooth and other device resources to detect and communicate with\nnearby devices. To ensure that users are in control of the experience, an opt-in\ndialog is presented the first time the user accesses the Nearby Messages API.\nThe user must provide consent for Nearby to utilize the required device\nresources.\n| **Note:** The opt in dialog won't be shown if you only use BLE, and your app has ACCESS_FINE_LOCATION permissions. See [BLE Only](#ble_only) for an example.\n\nBLE Only\n--------\n\nYou can avoid the opt in dialog if your app has been granted the\nACCESS_FINE_LOCATION permission and only uses BLE during publishes and\nsubscribes. \n\n if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)\n == PackageManager.PERMISSION_GRANTED) {\n mMessagesClient = Nearby.getMessagesClient(this, new MessagesOptions.Builder()\n .setPermissions(NearbyPermissions.BLE)\n .build());\n }"]]