Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frostney/react-native-bluetooth-state
:signal_strength: Answering the question of "Is my bluetooth on?" in React Native
https://github.com/frostney/react-native-bluetooth-state
bluetooth react-native
Last synced: about 1 month ago
JSON representation
:signal_strength: Answering the question of "Is my bluetooth on?" in React Native
- Host: GitHub
- URL: https://github.com/frostney/react-native-bluetooth-state
- Owner: frostney
- License: unlicense
- Created: 2015-07-17T22:45:37.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-01-30T22:24:55.000Z (almost 6 years ago)
- Last Synced: 2024-11-01T06:51:31.929Z (about 1 month ago)
- Topics: bluetooth, react-native
- Language: Objective-C
- Homepage:
- Size: 98.6 KB
- Stars: 73
- Watchers: 4
- Forks: 16
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-react-native - react-native-bluetooth-state ★61 - Answering the question of "Is my bluetooth on?" in React Native (Components / System)
- awesome-react-native - react-native-bluetooth-state ★61 - Answering the question of "Is my bluetooth on?" in React Native (Components / System)
- awesome-react-native - react-native-bluetooth-state ★61 - Answering the question of "Is my bluetooth on?" in React Native (Components / System)
- awesome-react-native-ui - react-native-bluetooth-state ★37 - Answering the question of "Is my bluetooth on?" in React Native (Components / System)
- awesome-react-native - react-native-bluetooth-state ★61 - Answering the question of "Is my bluetooth on?" in React Native (Components / System)
README
# react-native-bluetooth-state
Answering the question of "Is my bluetooth on?" in React NativeThis module only works for iOS at the moment.
## Installation
```
$ npm install react-native-bluetooth-state
```React Native >=0.7.0 is needed.
You then need to add the Objective-C part to your XCode project. Drag `RNBluetoothState.xcodeproj` from the `node_modules/react-native-bluetooth-state` folder into your XCode project. Click on the your project in XCode, goto Build Phases then Link Binary With Libraries and add `libRNBluetoothState.a` and `CoreBluetooth.framework`.
(Alternatively you can use RNPM to link the library, but in any case you need to link against `CoreBluetooth.framework`.)
## Usage
```javascript
import BluetoothState from 'react-native-bluetooth-state';BluetoothState.subscribe(bluetoothState => {
// bluetoothState can either be "on", "off", "unknown", "unauthorized", "resetting" or "unsupported‚"
});// Initialize needs to be called otherwise we don't get the initial state
BluetoothState.initialize();
```## License
Unlicense or MIT. Whatever fits your purpose best.