(旧)平凡エンジニアからの出発

https://atuyan39.hatenablog.com/ に移動しました。

【Android】android.bluetoothについて

Android developerのBluetooth機能について理解を深めていきます。

今回のテーマ

android.bluetooth  |  Android Developers

概要

Bluetoothには大別して、二種類あります。

Provides classes that manage Bluetooth functionality, such as scanning for devices, connecting with devices, and managing data transfer between devices. The Bluetooth API supports both "Classic Bluetooth" and Bluetooth Low Energy.

バイスのスキャン、デバイスとの接続、デバイス間のデータ転送の管理など、Bluetooth機能を管理するクラスを提供します。 Bluetooth APIは、「クラシックBluetooth」とBluetooth Low Energyの両方をサポートしています。

ガイドのリンクは下記です。

For more information about Classic Bluetooth, see the Bluetooth guide. For more information about Bluetooth Low Energy, see the Bluetooth Low Energy (BLE) guide.

クラシックBluetoothの詳細については、Bluetoothガイドを参照してください。 Bluetooth Low Energyの詳細については、Bluetooth Low Energy(BLE)ガイドを参照してください。

Bluetooth APIで実現できることについて、7つ。

The Bluetooth APIs let applications:

Bluetooth APIを使用すると、アプリケーションで次のことが可能になります。

・Scan for other Bluetooth devices (including BLE devices).

・他のBluetoothバイス(BLEデバイスを含む)をスキャンします。

・Query the local Bluetooth adapter for paired Bluetooth devices.

・ペアリングされたBluetoothバイスのローカルBluetoothアダプターをクエリします。

・Establish RFCOMM channels/sockets.

・RFCOMMチャネル/ソケットを確立します。

・Connect to specified sockets on other devices.

・他の機器の指定のソケットに接続してください。

・Transfer data to and from other devices.

・他の機器とのデータ転送。

・Communicate with BLE devices, such as proximity sensors, heart rate monitors, fitness devices, and so on.

・近接センサー、心拍数モニター、フィットネスデバイスなどのBLEデバイスと通信します。

・Act as a GATT client or a GATT server (BLE).

GATTクライアントまたはGATTサーバー(BLE)として機能します。

Bluetooth APIを使う際に必要な権限

To perform Bluetooth communication using these APIs, an application must declare the BLUETOOTH permission. Some additional functionality, such as requesting device discovery, also requires the BLUETOOTH_ADMIN permission.

これらのAPIを使用してBluetooth通信を実行するには、アプリケーションでBLUETOOTH権限を宣言する必要があります。 デバイス検出の要求など、いくつかの追加機能には、BLUETOOTH_ADMIN権限も必要です。

Interfaces

Classes