LoginSignup
13
20

More than 5 years have passed since last update.

AndroidでBLEのデータ通信を実装するときの参考

Last updated at Posted at 2016-05-06

参考記事

BLE端末のスタブ

AndroidでBLEアプリを作る場合、対応するBLE端末を用意する必要があります。
これにはiPhoneアプリのLightBlueが一番よいと思います。
仮想Peripheralの作成や、近くのPeripheralの検索などが出来ます。

サンプルコード

BLEのデバイスアドレスから、BluetoothDeviceのインスタンスを取得する

  BluetoothManager bluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
  BluetoothAdapter bluetoothAdapter = bluetoothManager.getAdapter();
  BluetoothDevice device = bluetoothAdapter.getRemoteDevice(deviceAddress);

参考: http://stackoverflow.com/questions/16902500/connect-to-device-with-bluetooth-address-on-string

13
20
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
20