tt =

tt = "Bluetooth on"; break; case (B

tt = "Bluetooth on"; break; case (BluetoothAdapter.STATE_TURNING_OFF) : tt = "Bluetooth turning off"; break; case (BluetoothAdapter.STATE_OFF) : tt = "Bluetooth off"; break; default: break;
}
Log.d(TAG, tt);
}
};
String actionStateChanged = BluetoothAdapter.ACTION_STATE_CHANGED; registerReceiver(bluetoothState,
new IntentFilter(actionStateChanged));
You can also turn the Bluetooth Adapter on and off directly, using the enable and disable methods, respectively, if you include the bluetooth_admin permission in your manifest.
This should be done only when absolutely necessary, and the user should always be notified if you are manually changing the Bluetooth Adapter status on the user’s behalf. In most cases you should use the Intent mechanism described earlier.
Being Discoverable and Remote Device Discovery
The process of two devices finding each other to connect is called discovery. Before you can establish a Bluetooth Socket for communications, the local Bluetooth Adapter must bond with the remote device. Before two devices can bond and connect, they first need to discover each other.
Although the Bluetooth protocol supports ad-hoc connections for data transfer, this mechanism is not currently available in Android. Android Bluetooth com¬munication is currently supported only between bonded devices.
Managing Device Discoverability
For an Android device to find your local Bluetooth Adapter during a discovery scan, you need to ensure that it’s discoverable. The Bluetooth Adapter’s discoverability is indicated by its scan mode, found using the getScanMode method on the BluetoothAdapter object.
It will return one of the following BluetoothAdapter constants:
► scan_mode_connectable_discoverable — Inquiry scan and page scan are both
enabled, meaning that the device is discoverable from any Bluetooth device performing a discovery scan. 
^ scan_mode_connectable — Page scan is enabled but inquiry scan is not. This means that devices that have previously connected and bonded to the local device can find it during discovery, but new devices can’t.
^ scan_mode_none — Discoverability is turned off. No remote devices can find the local Bluetooth Adapter during discovery.
For privacy reasons, Android devices will default to having discoverability disabled. To turn on discovery, you need to obtain explicit permission from the user; you do this by starting a new Activity using the action_request_discoverable action, as shown in Listing 16-3.
0/5000
Từ: -
Sang: -
Kết quả (Việt) 1: [Sao chép]
Sao chép!
TT = "Bluetooth trên"; phá vỡ; trường hợp (BluetoothAdapter.STATE_TURNING_OFF): tt = "Bluetooth tắt"; phá vỡ; trường hợp (BluetoothAdapter.STATE_OFF): tt = "Bluetooth ra"; phá vỡ; mặc định: phá vỡ;}Log.d (TAG, tt);}};String actionStateChanged = BluetoothAdapter.ACTION_STATE_CHANGED; registerReceiver (bluetoothState,mới IntentFilter(actionStateChanged));Bạn cũng có thể bật Bluetooth Adapter và tắt trực tiếp, bằng cách sử dụng các phép và vô hiệu hóa các phương pháp, tương ứng, nếu bạn bao gồm cho phép bluetooth_admin trong biểu hiện của bạn.Điều này nên được thực hiện chỉ khi hoàn toàn cần thiết, và người sử dụng nên luôn luôn được thông báo nếu bạn đang tự thay đổi tình trạng Bluetooth Adapter trên danh nghĩa của người dùng. Trong hầu hết trường hợp, bạn nên sử dụng các cơ chế mục đích mô tả trước đó.Đang phát hiện thiết bị có thể phát hiện và từ xaQuá trình hai thiết bị tìm kiếm lẫn nhau để kết nối được gọi là khám phá. Trước khi bạn có thể thiết lập một ổ cắm Bluetooth cho truyền thông, các địa phương Bluetooth Adapter phải liên kết với thiết bị từ xa. Trước khi hai thiết bị có thể trái phiếu và kết nối, họ lần đầu tiên cần phải khám phá lẫn nhau.Mặc dù các giao thức Bluetooth hỗ trợ kết nối ad-hoc để truyền dữ liệu, cơ chế này không phải là hiện đang có sẵn trong Android. Android Bluetooth com¬munication hiện đang được hỗ trợ chỉ giữa các thiết bị kho ngoại quan.Quản lý thiết bị DiscoverabilityFor an Android device to find your local Bluetooth Adapter during a discovery scan, you need to ensure that it’s discoverable. The Bluetooth Adapter’s discoverability is indicated by its scan mode, found using the getScanMode method on the BluetoothAdapter object.It will return one of the following BluetoothAdapter constants:► scan_mode_connectable_discoverable — Inquiry scan and page scan are bothenabled, meaning that the device is discoverable from any Bluetooth device performing a discovery scan. ^ scan_mode_connectable — Page scan is enabled but inquiry scan is not. This means that devices that have previously connected and bonded to the local device can find it during discovery, but new devices can’t.^ scan_mode_none — Discoverability is turned off. No remote devices can find the local Bluetooth Adapter during discovery.For privacy reasons, Android devices will default to having discoverability disabled. To turn on discovery, you need to obtain explicit permission from the user; you do this by starting a new Activity using the action_request_discoverable action, as shown in Listing 16-3.
đang được dịch, vui lòng đợi..
Kết quả (Việt) 2:[Sao chép]
Sao chép!
tt = "Bluetooth trên"; phá vỡ; trường hợp (BluetoothAdapter.STATE_TURNING_OFF): tt = "Bluetooth tắt"; phá vỡ; trường hợp (BluetoothAdapter.STATE_OFF): tt = "Bluetooth off"; phá vỡ; mặc định: break;
}
Log.d (TAG, tt);
}
};
Chuỗi actionStateChanged = BluetoothAdapter.ACTION_STATE_CHANGED; registerReceiver (bluetoothState,
IntentFilter mới (actionStateChanged));
. Bạn cũng có thể bật Adapter Bluetooth và tắt trực tiếp, bằng cách sử dụng phương pháp kích hoạt và vô hiệu hóa, tương ứng, nếu bạn bao gồm các phép bluetooth_admin trong biểu hiện của bạn
này nên được thực hiện chỉ khi thật cần thiết , và người sử dụng nên luôn luôn được thông báo nếu bạn đang tự thay đổi trạng thái Bluetooth adapter thay mặt của người dùng. Trong hầu hết các trường hợp, bạn nên sử dụng các cơ chế Ý định được mô tả trước đó.
Là Có thể phát hiện và Remote Device Discovery
Quá trình hai thiết bị tìm thấy nhau để kết nối được gọi là khám phá. Trước khi bạn có thể thiết lập một Socket Bluetooth cho truyền thông, Adapter Bluetooth địa phương phải liên kết với các thiết bị từ xa. Trước khi hai thiết bị có thể liên kết và kết nối, đầu tiên họ cần phải tìm hiểu lẫn nhau.
Mặc dù các giao thức Bluetooth hỗ trợ kết nối ad-hoc để truyền dữ liệu, cơ chế này không phải là hiện đang có sẵn trong Android. Android Bluetooth com¬munication hiện chỉ được hỗ trợ giữa các thiết bị ngoại quan.
Quản lý thiết bị năng khám phá
Đối với một thiết bị Android để tìm adapter Bluetooth cục bộ của bạn trong một phát hiện quét, bạn cần phải đảm bảo rằng nó có thể phát hiện. Khám phá các Adapter Bluetooth được chỉ định bởi chế độ quét của nó, được tìm thấy bằng cách sử dụng phương pháp getScanMode trên đối tượng BluetoothAdapter.
Nó sẽ trở lại một trong những hằng số BluetoothAdapter sau:
► scan_mode_connectable_discoverable - Tin nhắn của bạn quét và trang quét được cả hai
được kích hoạt, có nghĩa là thiết bị có thể phát hiện từ bất kỳ thiết bị Bluetooth thực hiện một khám phá quét. 
^ scan_mode_connectable - Page quét được kích hoạt nhưng cuộc điều tra quét không. Điều này có nghĩa là các thiết bị mà trước đây đã được kết nối và liên kết với các thiết bị cục bộ có thể tìm thấy nó trong quá trình phát hiện, nhưng các thiết bị mới không thể.
^ Scan_mode_none - Khả năng khám phá được tắt. Không có thiết bị điều khiển từ xa có thể tìm thấy Adapter Bluetooth cục bộ trong phát hiện.
Vì lý do riêng tư, thiết bị Android sẽ mặc định có khả năng khám phá vô hiệu hóa. Để bật về phát hiện, bạn cần phải có được sự cho phép rõ ràng từ người sử dụng; bạn làm điều này bằng cách bắt đầu một hành động mới sử dụng các hành động action_request_discoverable, như thể hiện trong Liệt kê 16-3.
đ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: