WHAT’S IN THIS CHAPTER?
> Managing Bluetooth devices and discoverability mode
> Discovering remote Bluetooth devices
> Communicating over Bluetooth
> Monitoring Internet connectivity
> Monitoring Wi-Fi and network details
> Configuring Wi-Fi and scanning for access points
> Transferring data using Wi-Fi Direct
> Scanning NFC tags
> Transferring data using Android Beam
This chapter begins to explore Android’s hardware communications APIs by examining the Bluetooth, network, Wi-Fi, and Near Field Communication (NFC) packages.
Android offers APIs to manage and monitor your Bluetooth settings: to control discoverability, to discover nearby Bluetooth devices, and to use Bluetooth as a proximity-based, peer-to-peer transport layer for your applications.
A full network and Wi-Fi package is also available. Using these APIs, you can scan for hotspots, create and modify Wi-Fi configuration settings, monitor your Internet connectivity,
and control and monitor Internet settings and preferences. The introduction of Wi-Fi Direct offers a peer-to-peer solution for communicating between devices using Wi-Fi.
Android 2.3 (API level 9) introduced support for NFC, including the support for reading smart tags, and Android 4.0 (API level 14) added the ability to communicate with other NFC-enabled Android devices using Android Beam.
USING BLUETOOTH
Bluetooth is a communications protocol designed for short-range, low-bandwidth peer-to-peer communications.
Using the Bluetooth APIs, you can search for, and connect to, other Bluetooth devices within range. By initiating a communications link using Bluetooth Sockets, you can then transmit and receive streams of data between devices from within your applications.
At the time of writing, only encrypted communication is supported between devices, meaning that you can form connections only between devices that have been paired.
Managing the Local Bluetooth Device Adapter
The local Bluetooth device is controlled via the BluetoothAdapter class, which represents the host Android device on which your application is running.
To access the default Bluetooth Adapter, call getDefaultAdapter, as shown in Listing 16-1. Some Android devices feature multiple Bluetooth adapters, though it is currently only possible to access the default device.
WHAT’S IN THIS CHAPTER?> Managing Bluetooth devices and discoverability mode> Discovering remote Bluetooth devices> Communicating over Bluetooth> Monitoring Internet connectivity> Monitoring Wi-Fi and network details> Configuring Wi-Fi and scanning for access points> Transferring data using Wi-Fi Direct> Scanning NFC tags> Transferring data using Android BeamThis chapter begins to explore Android’s hardware communications APIs by examining the Bluetooth, network, Wi-Fi, and Near Field Communication (NFC) packages.Android offers APIs to manage and monitor your Bluetooth settings: to control discoverability, to discover nearby Bluetooth devices, and to use Bluetooth as a proximity-based, peer-to-peer transport layer for your applications.A full network and Wi-Fi package is also available. Using these APIs, you can scan for hotspots, create and modify Wi-Fi configuration settings, monitor your Internet connectivity, and control and monitor Internet settings and preferences. The introduction of Wi-Fi Direct offers a peer-to-peer solution for communicating between devices using Wi-Fi.Android 2.3 (API level 9) introduced support for NFC, including the support for reading smart tags, and Android 4.0 (API level 14) added the ability to communicate with other NFC-enabled Android devices using Android Beam.USING BLUETOOTHBluetooth is a communications protocol designed for short-range, low-bandwidth peer-to-peer communications.Sử dụng các API của Bluetooth, bạn có thể tìm kiếm và kết nối với các thiết bị Bluetooth khác trong phạm vi. Việc khởi xướng một liên kết liên lạc bằng cách sử dụng Bluetooth ổ cắm, bạn có thể sau đó truyền và nhận được luồng dữ liệu giữa các thiết bị từ bên trong ứng dụng của bạn.Tại thời điểm viết, chỉ giao tiếp được mã hóa được hỗ trợ giữa các thiết bị, có nghĩa là bạn có thể tạo thành kết nối duy nhất giữa các thiết bị đã được kết nối.Quản lý địa phương thiết bị Bluetooth AdapterCác thiết bị Bluetooth địa phương được điều khiển thông qua các lớp học BluetoothAdapter, đại diện cho các thiết bị Android chủ mà trên đó các ứng dụng đang chạy.Để truy cập mặc định Bluetooth Adapter, gọi getDefaultAdapter, như được hiển thị trong danh sách 16-1. Một số thiết bị Android có nhiều bộ điều hợp Bluetooth, mặc dù nó là hiện nay chỉ có thể truy cập vào thiết bị mặc định.
đang được dịch, vui lòng đợi..

GÌ TRÊN CHƯƠNG NÀY?
> Quản lý thiết bị Bluetooth và chế độ khám phá
> Khám phá các thiết bị Bluetooth từ xa
> Giao tiếp qua Bluetooth
> Giám sát kết nối Internet
> Giám sát Wi-Fi và các chi tiết mạng
> Cấu hình Wi-Fi và quét các điểm truy cập
> Chuyển dữ liệu sử dụng Wi-Fi trực tiếp
> thẻ quét NFC
> Chuyển dữ liệu sử dụng Android beam chương này bắt đầu khám phá các API thông phần cứng Android bằng cách kiểm tra Bluetooth, mạng Wi-Fi, và Near Field Communication (NFC) gói. Android cung cấp các API để quản lý và giám sát cài đặt Bluetooth :. để kiểm soát khả năng khám phá, khám phá gần các thiết bị Bluetooth, và sử dụng Bluetooth như một, peer-to-peer tầng giao thông gần gũi đối với ứng dụng của bạn một mạng lưới đầy đủ và trọn gói Wi-Fi cũng có sẵn. Sử dụng các API này, bạn có thể quét các điểm nóng, tạo và sửa đổi các thiết lập cấu hình Wi-Fi, theo dõi kết nối Internet của bạn, và kiểm soát và giám sát các thiết lập Internet và sở thích. Sự ra đời của Wi-Fi trực tiếp cung cấp một giải pháp peer-to-peer để giao tiếp giữa các thiết bị sử dụng Wi-Fi. Android 2.3 (API cấp 9) giới thiệu hỗ trợ NFC, bao gồm hỗ trợ cho việc đọc thẻ thông minh, và Android 4.0 (cấp API 14) thêm khả năng giao tiếp với các thiết bị Android NFC khác cho phép sử dụng Android beam. sỬ dỤNG BLUETOOTH Bluetooth là một giao thức truyền thông được thiết kế cho tầm ngắn, băng thông thấp peer-to-peer truyền thông. sử dụng các API Bluetooth, bạn có thể tìm kiếm và kết nối tới, các thiết bị Bluetooth khác trong phạm vi. Bằng cách kích hoạt một liên kết truyền thông sử dụng Bluetooth Sockets, sau đó bạn có thể truyền và nhận được dòng dữ liệu giữa các thiết bị từ bên trong các ứng dụng của bạn. Tại thời điểm viết bài, thông tin liên lạc chỉ được mã hóa được hỗ trợ giữa các thiết bị, có nghĩa là bạn có thể tạo các kết nối duy nhất giữa các thiết bị có được ghép nối. Quản lý các thiết bị adapter Local Bluetooth các thiết bị Bluetooth cục bộ được điều khiển thông qua các lớp BluetoothAdapter, đại diện cho các thiết bị Android của máy chủ mà trên đó các ứng dụng của bạn đang chạy. Để truy cập mặc định Bluetooth adapter, gọi getDefaultAdapter, như thể hiện trong Liệt kê 16-1 . Một số thiết bị Android tính năng nhiều adapter Bluetooth, mặc dù hiện nay chỉ có thể truy cập vào các thiết bị mặc định.
đang được dịch, vui lòng đợi..
