Skip to content

Instantly share code, notes, and snippets.

@MacKentoch
Last active February 21, 2017 13:24
Show Gist options
  • Save MacKentoch/783e2f17d701c03396e07228d60cd295 to your computer and use it in GitHub Desktop.
Save MacKentoch/783e2f17d701c03396e07228d60cd295 to your computer and use it in GitHub Desktop.
import Beacons from 'react-native-beacons-manager';
class RNbeaconArticle extends Component {
// ...
componentWillMount(){
//
// ONLY non component state aware here in componentWillMount
//
// Request for authorization while the app is open
Beacons.requestWhenInUseAuthorization();
// Define a region which can be identifier + uuid,
// identifier + uuid + major or identifier + uuid + major + minor
// (minor and major properties are numbers)
const region = {
identifier: 'GemTot for iOS',
uuid: '6665542b-41a1-5e00-931c-6a82db9b78c1' // => IMPORTANT: replace here with your beacon "uuid"
};
// Range for beacons inside the region
Beacons.startRangingBeaconsInRegion(region);
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment