Lớp GNSMessageManagerParams
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Các tham số bổ sung cho trình quản lý thông báo.
Kế thừa NSObject.
- (BOOL) showBluetoothPowerAlert |
|
readwritenonatomicassign |
Hiện cảnh báo hệ thống khi Bluetooth tắt. Mặc định là CÓ.
- (GNSErrorStateHandler) microphonePermissionErrorHandler |
|
readwritenonatomiccopy |
Các trình xử lý lỗi sau đây được gọi (trên luồng chính) khi trạng thái của lỗi thay đổi.
Giá trị YES có nghĩa là có lỗi. Quyền truy cập vào micrô bị từ chối.
- (GNSErrorStateHandler) bluetoothPermissionErrorHandler |
|
readwritenonatomiccopy |
Quyền truy cập Bluetooth bị từ chối.
- (GNSErrorStateHandler) bluetoothPowerErrorHandler |
|
readwritenonatomiccopy |
- (BOOL) useBestAudioSessionCategory |
|
readwritenonatomicassign |
Tham số này chỉ liên quan nếu ứng dụng của bạn sử dụng phương tiện âm thanh để khám phá.
Khi được đặt thành YES, tính năng Lân cận sẽ đặt danh mục và tùy chọn AVAudioSession thành giá trị phù hợp nhất cho tính năng Nearby: AVAudioSessionCategoryPlayAndRecord và AVAudioSessionCategoryDefaultToLoa, tương ứng. Nếu bạn đặt chính sách này thành KHÔNG, danh mục và tùy chọn hiện tại sẽ được tính năng Lân cận giữ nguyên và sử dụng. Điều này có thể khiến tính năng Lân cận không thể phát hoặc ghi âm. Ví dụ: nếu ứng dụng của bạn sử dụng AVAudioSessionCategoryAmbient, tính năng Lân cận có thể không nghe được âm thanh từ các thiết bị ở gần. Nếu ứng dụng của bạn sử dụng AVAudioSessionCategoryRecord, tính năng Lân cận sẽ không thể phát âm thanh đến các thiết bị ở gần. Mặc định là YES.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-08-13 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-13 UTC."],[[["\u003cp\u003e\u003ccode\u003eGNSMessageManagerParams\u003c/code\u003e provides additional parameters for managing Nearby Messages.\u003c/p\u003e\n"],["\u003cp\u003eIt includes properties to control system alerts for Bluetooth, handle errors related to microphone/Bluetooth permissions and power, and optimize audio sessions for discovery.\u003c/p\u003e\n"],["\u003cp\u003eBy default, the system alert for Bluetooth power is shown and Nearby attempts to use the best audio session configuration for discovery.\u003c/p\u003e\n"],["\u003cp\u003eError handlers can be set to respond to microphone and Bluetooth permission or power issues.\u003c/p\u003e\n"]]],[],null,["# GNSMessageManagerParams Class\n\n[Properties](#properties) \nGNSMessageManagerParams Class Reference \n\nOverview\n--------\n\nAdditional parameters for the message manager.\n\nInherits NSObject.\n\n|----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|\n| Property Summary ---------------- ||\n| BOOL | [showBluetoothPowerAlert](/nearby/messages/ios/reference/interface_g_n_s_message_manager_params#aa1372276d05adf851d6fe29b2cfd7750) |\n| | Show the system alert when Bluetooth is off. Default is YES. [More...](#aa1372276d05adf851d6fe29b2cfd7750) |\n| ||\n| GNSErrorStateHandler | [microphonePermissionErrorHandler](/nearby/messages/ios/reference/interface_g_n_s_message_manager_params#ad2d25ff9a6bad90dd9c62dc17b765ff6) |\n| | The following error handlers are called (on the main thread) when the status of the error changes. [More...](#ad2d25ff9a6bad90dd9c62dc17b765ff6) |\n| ||\n| GNSErrorStateHandler | [bluetoothPermissionErrorHandler](/nearby/messages/ios/reference/interface_g_n_s_message_manager_params#a4d3c4e29e095463aac955746a5ecd871) |\n| | Bluetooth permission is denied. [More...](#a4d3c4e29e095463aac955746a5ecd871) |\n| ||\n| GNSErrorStateHandler | [bluetoothPowerErrorHandler](/nearby/messages/ios/reference/interface_g_n_s_message_manager_params#ae2bc4df92182fad9ba92e6c2d8938c1c) |\n| | Bluetooth is powered off. [More...](#ae2bc4df92182fad9ba92e6c2d8938c1c) |\n| ||\n| BOOL | [useBestAudioSessionCategory](/nearby/messages/ios/reference/interface_g_n_s_message_manager_params#a973c0bd7e77fb6c4f59440af88eaa9dc) |\n| | This parameter is relevant only if your app uses the audio medium for discovery. [More...](#a973c0bd7e77fb6c4f59440af88eaa9dc) |\n| ||\n\nProperty Detail\n---------------\n\n|---------------------------------------------------------------------------|--------------------------|\n| |----------------------------------| | - (BOOL) showBluetoothPowerAlert | | readwritenonatomicassign |\n\nShow the system alert when Bluetooth is off. Default is YES. \n\n|-----------------------------------------------------------------------------------------------------------------------------|------------------------|\n| |-----------------------------------------------------------| | - (GNSErrorStateHandler) microphonePermissionErrorHandler | | readwritenonatomiccopy |\n\nThe following error handlers are called (on the main thread) when the status of the error changes.\n\nA value of YES implies an error. Microphone permission is denied. \n\n|---------------------------------------------------------------------------------------------------------------------------|------------------------|\n| |----------------------------------------------------------| | - (GNSErrorStateHandler) bluetoothPermissionErrorHandler | | readwritenonatomiccopy |\n\nBluetooth permission is denied. \n\n|-----------------------------------------------------------------------------------------------------------------|------------------------|\n| |-----------------------------------------------------| | - (GNSErrorStateHandler) bluetoothPowerErrorHandler | | readwritenonatomiccopy |\n\nBluetooth is powered off. \n\n|-----------------------------------------------------------------------------------|--------------------------|\n| |--------------------------------------| | - (BOOL) useBestAudioSessionCategory | | readwritenonatomicassign |\n\nThis parameter is relevant only if your app uses the audio medium for discovery.\n\nWhen set to YES, Nearby will set the AVAudioSession category and options to the values that work best for Nearby: AVAudioSessionCategoryPlayAndRecord and AVAudioSessionCategoryOptionDefaultToSpeaker, respectively. If you set it to NO, the current category and options will be preserved and used by Nearby. This may result in the inability for Nearby to broadcast or record audio. For example, if your app uses AVAudioSessionCategoryAmbient, Nearby may not be able to listen to audio from nearby devices. If your app uses AVAudioSessionCategoryRecord, Nearby will not be able to broadcast audio to nearby devices. Default is YES."]]