با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
Nearby Messages API به دلیل استفاده از بلوتوث و سایر منابع دستگاه برای شناسایی و برقراری ارتباط با دستگاههای اطراف، پتانسیل مصرف باتری را دارد. برای اطمینان از اینکه کاربران کنترل تجربه را در دست دارند، اولین باری که کاربر به API پیامهای نزدیک دسترسی پیدا میکند، یک گفتگوی انتخاب کردن ارائه میشود. کاربر باید رضایت Nearby را برای استفاده از منابع دستگاه مورد نیاز ارائه دهد.
فقط BLE
اگر به برنامه شما مجوز ACCESS_FINE_LOCATION اعطا شده باشد و فقط در هنگام انتشار و اشتراک از BLE استفاده کند، میتوانید از گفتگوی شرکت کردن اجتناب کنید.
تاریخ آخرین بهروزرسانی 2025-09-03 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-09-03 بهوقت ساعت هماهنگ جهانی."],[[["\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 }"]]