[null,null,["最后更新时间 (UTC):2025-08-29。"],[[["\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 }"]]