Download - Introduction of Eddystone

Transcript
Page 1: Introduction of Eddystone

Introduction of Eddystone

Shibuya.apk #3Namito Satoyama

Page 2: Introduction of Eddystone

About MeNamito SatoyamaFujitsu FIP Corp. (2001~)UL Systems, Inc. (2006~)CyberAgent, Inc. (2010~)

DeNA Co., Ltd. (2013~)Yahoo Japan Corp. (2014~)

GMO System Consulting, Inc. (2012~)

- Shibuya.apk 運営

- 元日本Androidの会の中の人

- CAMP - groovy - mobage - hackadoll

Page 3: Introduction of Eddystone

What is Eddystone ?

Page 4: Introduction of Eddystone

Eddystone7月に発表されたBLE(Bluetooth Low Energy)Beaconの規格

Googleが主導で策定AppleのiBeaconの競合にあたるiBeaconと異なり規格自体がオープンAndroid/iOS両対応iBeaconより多くのデータ形式(フレーム)を送出可

https://github.com/google/eddystoneGithubにて仕様とサンプルコードが公開中

Page 5: Introduction of Eddystone

Eddystone

Page 6: Introduction of Eddystone

何が出来るようになる?例)映画のポスターに近づくと公式サイトやティザーが見れる

プロモーション促進NFCよりもユーザが受動的に情報を受け取れる

beacon

poster

他にもショッピングをはじめ、様々なO2Oの利用方法が考えられる

Page 7: Introduction of Eddystone

iBeaconとのフレームタイプ比較

iBeacon Eddystone-UID

Eddystone-URL

EddyStone-TLM

固定のIDや数字を送出できる

iBeaconとほぼ同様のデータを送出できる

IDや任意のURLを送出

バッテリー残量や温度などの状態を送出

iBeaconの1フレームに対し、Eddystoneは3フレームがある

iBeacon Eddystone

Page 8: Introduction of Eddystone

Proximity Beacons、Nearby APIProximity Beacon APIでクラウドに登録、Nearby APIで添付データを取得できる

Page 9: Introduction of Eddystone

環境を準備してみる

Page 10: Introduction of Eddystone

Partner複数パートナーによる既存のbeaconもアップデートで対応

Page 11: Introduction of Eddystone

estimote beacons2年間放置していたestimote beaconsを引っ張りだしてみた(この時点ではiBeacon仕様)

電池交換のためケースを壊した

Page 12: Introduction of Eddystone

estimote beaconsコンパニオンアプリでBeaconに接続するとBeaconのファームウェアをアプデ可能だった

イケー

Page 13: Introduction of Eddystone

estimote beaconsアプデ後あっさりフレームタイプを変更可能になった!

Page 14: Introduction of Eddystone

TxEddystone-UIDEddystone-UIDについては、github上のサンプルアプリを利用してBeaconのエミュレーションすることが可能(Android 5.0以上)(チップセットでBLE Advertisingがサポートされている機種のみ)

moto x (2nd gen)は対応してなかった!

Page 15: Introduction of Eddystone

とりあえず動作検証

Page 16: Introduction of Eddystone

Eddystone-URLを試すフレームをEddystone-URLに変更してURLをBeaconに書き込み

※本来は短縮URL推奨

Page 17: Introduction of Eddystone

Chromeで動作確認7/22に公開された「Chrome 44」でiOSのみEddystoneに対応beaconにiPhoneを近づけると通知領域に、beaconに書き込んだURLが表示される(今日の領域)

Page 18: Introduction of Eddystone

Androidアプリから読み取る

Page 19: Introduction of Eddystone

Eddystone Validatorgithubのサンプル。Eddystoneのフレームタイプ判定をするアプリAndroid 5.1以上で利用可能(https://github.com/google/eddystone/tree/master/tools/eddystone-validator)

Page 20: Introduction of Eddystone

Permission

Features<uses-feature android:name="android.hardware.bluetooth_le" android:required="true" />

<uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

Implementation

Page 21: Introduction of Eddystone

android.bluetooth.le.BluetoothLeScanner

BluetoothManager manager = (BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE) ;BluetoothAdapter adapter = manager.getAdapter();

if( ! adapter.isEnabled() ){ // request Bluetooth Access Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(intent, REQUEST_ID);}

BluetoothLeScanner scanner = adapter.getBluetoothLeScanner();

Implementation

Page 22: Introduction of Eddystone

android.bluetooth.le.ScanSettings

ScanSettings settings = ScanSettings.Builder() .setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY) .setReportDelay(0) .build();

Implementation

BLE ScanMode

Page 23: Introduction of Eddystone

android.bluetooth.le.ScanFilter

ParcelUuid serviceUuid = ParcelUuid.fromString(“0000FEAA-0000-1000-8000-00805F9B34FB”);ScanFilter filter = new ScanFilter.Builder.setServiceUuid(serviceUuid).build();List<ScanFilter> filters = new ArrayList<>();filters.add(filter);

Implementation

BLE Service FilteringEddystone UUID: 「0000FEAA-0000-1000-8000-00805F9B34FB」

Page 24: Introduction of Eddystone

Scanscanner.startScan(filters, settings, new ScanCallback() { @Override public void onScanResult(int callbackType, ScanResult result) { // result handling   ScanRecord scanRecord = result.getScanRecord();   byte[] serviceData = scanRecord.getServiceData(serviceUuid); } @Override public void onScanFailed(int errorCode) { // error handling }});

Implementation

Page 25: Introduction of Eddystone

Data Convert

Implementation

switch (serviceData[0]) { case 0x00: // Edystone-UID handling break; case 0x10: // Edystone-URL handling break; case 0x20: // Edystone-TLM handling break; default: break;}

先頭1バイトでFrameTypeが決定されるので、分岐させて、それぞれのType毎にコンバートしていく

Edystone-URL Frame Spec

Page 26: Introduction of Eddystone

まとめ

Page 27: Introduction of Eddystone

まとめEddystoneはiBeaconより汎用性があっておもしろいEddystoneでNFCに続きおもしろいO2Oソリューションが考えられそう仕様自体はNFC等に比べるとめちゃくちゃシンプルすでにEddystone ReadyなbeaconあるよChromeは対応の方向性、Androidにもそのうち来る?Eddystoneの読み込み自体は簡単NFCのように今後OSレベルで対応する?(わからない)

Page 28: Introduction of Eddystone

Thanks