三分鐘讓你輕鬆開發 ibeacon

15
只要 三分鐘 讓你輕鬆開發 iBeacon Allen Tsai 2015.04.01 (三) ‧‧‧ ‧‧‧ ‧‧‧

Upload: allen-tsai

Post on 17-Jul-2015

530 views

Category:

Technology


5 download

TRANSCRIPT

Page 1: 三分鐘讓你輕鬆開發 iBeacon

只要三分鐘讓你輕鬆開發 iBeacon

Allen Tsai

2015.04.01 (三)

什麼只要三分鐘‧‧‧

是不是騙人的啊‧‧‧

聽說今天是愚人節‧‧‧

Page 2: 三分鐘讓你輕鬆開發 iBeacon

iBeacon 正在改變我們的生活?

共同參與創新科技革命

Page 3: 三分鐘讓你輕鬆開發 iBeacon

通過此 Workshop 你將…

安裝‧使用 Android Studio

巡覽 Estimote 範例專案

認識 Estimote SDK

體驗實際應用

Page 4: 三分鐘讓你輕鬆開發 iBeacon

iBeacon 本身屬性值

Estimote 提供資訊

Estimote iBeacon 裝置資訊

Page 5: 三分鐘讓你輕鬆開發 iBeacon

Estimote App 應用

靠近時商品時,通知…

附近商品資訊,購買…

查詢商品距離,偵測…

Page 6: 三分鐘讓你輕鬆開發 iBeacon

初探 Estimote API

Page 7: 三分鐘讓你輕鬆開發 iBeacon

Type Function Name Function Description

String getMacAddress() Return MAC address of the beacon.

int getMajor() Return Major version of the beacon.

int getMeasuredPower() Return Measured power of the beacon (in dBm).

int getMinor() Return Minor version of the beacon.

String getName() Return Device friendly name (this name is advertised by the beacon).

String getProximityUUID()Return Proximity UUID of the beacon in format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX (all lowercases).

int getRssi()Return Received Signal Strength Indication at the moment of scanning.

com.estimote.sdk

Class Beacon

Page 8: 三分鐘讓你輕鬆開發 iBeacon

com.estimote.sdk.connection

Class BeaconConnection.BeaconCharacteristics

Type Function Name Function Description

Integer getAdvertisingIntervalMillis()Returns Advertising interval in milliseconds.

Integer getBatteryPercent()Returns Battery level in percent.

Byte getBroadcastingPower() Returns Broadcasting power.

String getHardwareVersion() Returns Revision of hardware.

String getSoftwareVersion()Returns Version of operating system.

Page 9: 三分鐘讓你輕鬆開發 iBeacon

com.estimote.sdk

Class Utils

Type Function Name

static doublecomputeAccuracy(Beacon beacon)

Returns distance in meters based on beacon's RSSI and measured power.

static booleanisBeaconInRegion(Beacon beacon, Region region)

Returns true if beacon matches the region.

static voidrestartBluetooth(Context context, Utils.RestartCompletedListener listener)

Restarts Bluetooth stack on the device.

Page 10: 三分鐘讓你輕鬆開發 iBeacon

com.estimote.sdk.connection

Class BeaconConnection

Function Name

void:writeAdvertisingInterval(int intervalMillis, BeaconConnection.WriteCallback writeCallback)Changes advertising interval of the beacon.

void:writeBroadcastingPower(int powerDBM, BeaconConnection.WriteCallback writeCallback) Changes broadcasting power of the beacon.

void:writeMajor(int major, BeaconConnection.WriteCallback writeCallback) Changes major value of the beacon.

void:writeMinor(int minor, BeaconConnection.WriteCallback writeCallback) Changes minor value of the beacon.

void:writeProximityUuid(String proximityUuid, BeaconConnection.WriteCallback writeCallback) Changes proximity UUID of the beacon.

Page 11: 三分鐘讓你輕鬆開發 iBeacon

iBeacon Demo Project on Android Studio

Page 12: 三分鐘讓你輕鬆開發 iBeacon

Estimote Demo App Hands-on

Page 13: 三分鐘讓你輕鬆開發 iBeacon

private static final String ESTIMOTE_PROXIMITY_UUID = "B9407F30-F5F8-466E-AFF9-25556B57FE6D";private static final Region ALL_ESTIMOTE_BEACONS =

new Region("regionId", ESTIMOTE_PROXIMITY_UUID, null, null); private BeaconManager beaconManager = new BeaconManager(context);

// Should be invoked in #onCreate.beaconManager.setRangingListener(new BeaconManager.RangingListener() {

@Override public void onBeaconsDiscovered(Region region, List<Beacon> beacons) { Log.d(TAG, "Ranged beacons: " + beacons);

} });

// Should be invoked in #onStart.beaconManager.connect(new BeaconManager.ServiceReadyCallback() {

@Override public void onServiceReady() {try {

beaconManager.startRanging(ALL_ESTIMOTE_BEACONS); }catch (RemoteException e) {

Log.e(TAG, "Cannot start ranging", e); }

}});

// Should be invoked in #onStop.try {

beaconManager.stopRanging(ALL_ESTIMOTE_BEACONS);}catch (RemoteException e) {

Log.e(TAG, "Cannot stop but it does not matter now", e);}

// When no longer needed. Should be invoked in #onDestroy.beaconManager.disconnect();

快速上手操作

iBe

ac

on

Page 14: 三分鐘讓你輕鬆開發 iBeacon

觀察‧體會‧生活

創新就在你我身邊