To read any of the local Bluetooth Adapter properties, initiate discov dịch - To read any of the local Bluetooth Adapter properties, initiate discov Việt làm thế nào để nói

To read any of the local Bluetooth

To read any of the local Bluetooth Adapter properties, initiate discovery, or find bonded devices, you need to include the bluetooth permission in your application manifest. To modify any of the local device properties, the bluetooth_admin permission is also required:


The Bluetooth Adapter offers methods for reading and setting properties of the local Bluetooth hardware. 
The Bluetooth Adapter properties can be read and changed only if the Bluetooth Adapter is currently turned on — that is, if its device state is enabled. If the device is off, these methods will return null.
Use the isEnabled method to confirm the device is enabled, after which you can access the Bluetooth Adapter’s friendly name (an arbitrary string that users can set to identify a particular device) and hardware address, using the getName and getAddress methods, respectively:
if (bluetooth.isEnabled()) {
String address = bluetooth.getAddress();
String name = bluetooth.getName();
}
If you have the bluetooth_admin permission, you can change the friendly name of the Bluetooth Adapter using the setName method:
bluetooth.setName("Blackfang");
To find a more detailed description of the current Bluetooth Adapter state, use the getState method, which will return one of the following BluetoothAdapter constants:
> STATE_TURNING_ON
> STATE_ON
> STATE_TURNING_OFF
> STATE_OFF
To conserve battery life and optimize security, most users will keep Bluetooth disabled until they plan to use it.
To enable the Bluetooth Adapter, you can start a system Preference Activity using the BluetoothAdapter.ACTION_REQUEST_ENABLE static constant as a startActivityForResult action string:
startActivityForResult!
new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE), 0);
Figure 16-1 shows the resulting Preference Activity.
0/5000
Từ: -
Sang: -
Kết quả (Việt) 1: [Sao chép]
Sao chép!
To read any of the local Bluetooth Adapter properties, initiate discovery, or find bonded devices, you need to include the bluetooth permission in your application manifest. To modify any of the local device properties, the bluetooth_admin permission is also required:The Bluetooth Adapter offers methods for reading and setting properties of the local Bluetooth hardware. The Bluetooth Adapter properties can be read and changed only if the Bluetooth Adapter is currently turned on — that is, if its device state is enabled. If the device is off, these methods will return null.Use the isEnabled method to confirm the device is enabled, after which you can access the Bluetooth Adapter’s friendly name (an arbitrary string that users can set to identify a particular device) and hardware address, using the getName and getAddress methods, respectively:if (bluetooth.isEnabled()) {String address = bluetooth.getAddress();String name = bluetooth.getName();}If you have the bluetooth_admin permission, you can change the friendly name of the Bluetooth Adapter using the setName method:bluetooth.setName("Blackfang");To find a more detailed description of the current Bluetooth Adapter state, use the getState method, which will return one of the following BluetoothAdapter constants:> STATE_TURNING_ON> STATE_ON> STATE_TURNING_OFF> STATE_OFFTo conserve battery life and optimize security, most users will keep Bluetooth disabled until they plan to use it.To enable the Bluetooth Adapter, you can start a system Preference Activity using the BluetoothAdapter.ACTION_REQUEST_ENABLE static constant as a startActivityForResult action string:startActivityForResult!new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE), 0);Figure 16-1 shows the resulting Preference Activity.
đang được dịch, vui lòng đợi..
Kết quả (Việt) 2:[Sao chép]
Sao chép!
Để đọc bất kỳ thuộc tính Bluetooth Adapter địa phương, bắt đầu phát hiện ra, hoặc tìm các thiết bị ngoại quan, bạn cần phải bao gồm các phép bluetooth trong manifest ứng dụng của bạn. Để sửa đổi bất kỳ tài sản thiết bị địa phương, được sự cho phép bluetooth_admin cũng được yêu cầu:


Adapter Bluetooth cung cấp các phương pháp đọc sách và tài sản thiết lập của phần cứng Bluetooth cục bộ. 
Các tính chất Bluetooth Adapter có thể được đọc và thay đổi chỉ khi Adapter Bluetooth đang bật - đó là, nếu nhà nước thiết bị của nó được kích hoạt. Nếu điện thoại tắt, các phương pháp này sẽ trả về null.
Sử dụng các phương pháp isEnabled để xác nhận các thiết bị được kích hoạt, sau đó bạn có thể truy cập vào tên Adapter Bluetooth thân thiện (một chuỗi tùy ý rằng người dùng có thể thiết lập để xác định một thiết bị đặc biệt) và địa chỉ phần cứng , sử dụng getName và getAddress phương pháp, lần lượt là:
if (bluetooth.isEnabled ()) {
string địa chỉ = bluetooth.getAddress ();
string name = bluetooth.getName ();
}
Nếu bạn có quyền bluetooth_admin, bạn có thể thay đổi thân thiện tên của adapter Bluetooth bằng cách sử dụng phương pháp setName:
bluetooth.setName ( "Blackfang");
Để tìm mô tả chi tiết hơn về tình trạng Bluetooth adapter hiện tại, sử dụng phương pháp getState, mà sẽ trả về một trong các hằng số BluetoothAdapter sau:
> STATE_TURNING_ON
> STATE_ON
> STATE_TURNING_OFF
> STATE_OFF
để tiết kiệm pin và tối ưu hóa bảo mật, hầu hết người dùng sẽ tiếp Bluetooth tàn tật cho đến khi họ có kế hoạch để sử dụng nó.
để kích hoạt adapter Bluetooth, bạn có thể bắt đầu một hệ thống Hoạt động Sở thích sử dụng hằng tĩnh BluetoothAdapter.ACTION_REQUEST_ENABLE như một hành động startActivityForResult chuỗi:
! startActivityForResult
Ý định mới (BluetoothAdapter.ACTION_REQUEST_ENABLE), 0);
Hình 16-1 cho thấy các kết quả Hoạt động Preference.
đang được dịch, vui lòng đợi..
 
Các ngôn ngữ khác
Hỗ trợ công cụ dịch thuật: Albania, Amharic, Anh, Armenia, Azerbaijan, Ba Lan, Ba Tư, Bantu, Basque, Belarus, Bengal, Bosnia, Bulgaria, Bồ Đào Nha, Catalan, Cebuano, Chichewa, Corsi, Creole (Haiti), Croatia, Do Thái, Estonia, Filipino, Frisia, Gael Scotland, Galicia, George, Gujarat, Hausa, Hawaii, Hindi, Hmong, Hungary, Hy Lạp, Hà Lan, Hà Lan (Nam Phi), Hàn, Iceland, Igbo, Ireland, Java, Kannada, Kazakh, Khmer, Kinyarwanda, Klingon, Kurd, Kyrgyz, Latinh, Latvia, Litva, Luxembourg, Lào, Macedonia, Malagasy, Malayalam, Malta, Maori, Marathi, Myanmar, Mã Lai, Mông Cổ, Na Uy, Nepal, Nga, Nhật, Odia (Oriya), Pashto, Pháp, Phát hiện ngôn ngữ, Phần Lan, Punjab, Quốc tế ngữ, Rumani, Samoa, Serbia, Sesotho, Shona, Sindhi, Sinhala, Slovak, Slovenia, Somali, Sunda, Swahili, Séc, Tajik, Tamil, Tatar, Telugu, Thái, Thổ Nhĩ Kỳ, Thụy Điển, Tiếng Indonesia, Tiếng Ý, Trung, Trung (Phồn thể), Turkmen, Tây Ban Nha, Ukraina, Urdu, Uyghur, Uzbek, Việt, Xứ Wales, Yiddish, Yoruba, Zulu, Đan Mạch, Đức, Ả Rập, dịch ngôn ngữ.

Copyright ©2025 I Love Translation. All reserved.

E-mail: