Socket
Socket
Sign inDemoInstall

react-native-beacon-radar

Package Overview
Dependencies
533
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-beacon-radar

Module to scan for iBeacons on iOS and Android, within React Native and Expo managed projects.


Version published
Weekly downloads
5.9K
decreased by-13.53%
Maintainers
1
Install size
6.70 MB
Created
Weekly downloads
 

Readme

Source

react-native-beacon-radar

CURRENTLY IN PROGRESS.... RIGHT NOW ONLY SCANS FOR CERTAIN IBEACON

Package to scan for iBeacons on both Android and IOS. This module is fully compatible with Expo (Will not work with Expo Go, but will work with development build.)

Installation

npm install react-native-beacon-radar

OR

yarn add react-native-beacon-radar

Basic usage

import { DeviceEventEmitter } from 'react-native';
import { startScanning } from 'react-native-beacon-radar';

// ...

startScanning('YOUR UUID', {
  useForegroundService: true,
  useBackgroundScanning: true,
});

DeviceEventEmitter.addListener('onBeaconsDetected', (beacons) => {
  console.log('onBeaconsDetected', beacons);
});

Current API:

MethodDescription
requestWhenInUseAuthorizationThis method should be called before anything else is called. It handles to request the use of beacons while the application is open. If the application is in the background, you will not get a signal from beacons.
requestAlwaysAuthorizationThis method should be called before anything else is called. It handles to request the use of beacons while the application is open or in the background.
getAuthorizationStatusThis methods gets the current authorization status.
startScanningThis method starts scanning for a certain beacon based on its UUID.
startRadar (Android only)This method starts scanning for all beacons in range. This is only available on Android.
EventDescription
onBeaconsDetectedThis event gets called when the beacon you are searching for is in range.

Expo

This module will work with the Expo managed workflow. It will not however work with Expo Go, since it needs native features. You can use the development build of Expo to test this module. More about this can be found here. To use this module in expo managed add the following to your app.json:

"expo": {
  "ios": {
    "infoPlist": {
      "NSLocationWhenInUseUsageDescription": "We need your location to detect nearby beacons.",
      "NSLocationAlwaysUsageDescription": "We need your location to detect nearby beacons even when the app is in the background.",
      "NSLocationAlwaysAndWhenInUseUsageDescription": "We need your location to detect nearby beacons even when the app is in the background."
    }
  },
  "plugins": [
    "react-native-beacon-radar"
  ]
}

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

Keywords

FAQs

Last updated on 21 May 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc