forked from jbeuckm/TiBeacons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.md~
46 lines (34 loc) · 999 Bytes
/
README.md~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
### Usage ###
See this example app for usage: [TiBeacons Example App](https://github.com/jbeuckm/TiBeacons-Example-App)
Become an iBeacon:
```javascript
var TiBeacons = require('org.beuckman.tibeacons');
TiBeacons.addEventListener("advertisingStatus", function(event) {
Ti.API.info(event.status);
});
TiBeacons.startAdvertisingBeacon({
uuid : "00000000-0000-0000-0000-000000000000",
identifier : "TiBeacon Test",
major: 1,
minor: 2
});
```
Find and range iBeacons:
```javascript
var TiBeacons = require('org.beuckman.tibeacons');
TiBeacons.addEventListener("beaconRanges", function(event) {
alert(event.beacons);
});
TiBeacons.startRangingForBeacons({
uuid : "00000000-0000-0000-0000-000000000000",
identifier : "TiBeacon Test",
major: 1, // optional
minor: 2 // optional
});
```
Listen for beacon proximity changes:
```
TiBeacons.addEventListener("beaconProximity", function(e){
alert("beacon "+e.major+"/"+e.minor+" is now "+e.proximity);
});
```