Skip to content

Commit 75f4f51

Browse files
author
Christian Ost
committed
updates README.md
1 parent 14f316d commit 75f4f51

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,44 @@ dependencies {
3131
3232
```
3333

34+
Add the package in your `MainApplication.java`:
35+
36+
```java
37+
// other imports
38+
import com.artirigo.bluetoothstate.RNBluetoothStatePackage;
39+
40+
public class MainApplication extends Application implements ReactApplication {
41+
// ...
42+
43+
protected List<ReactPackage> getPackages() {
44+
return Arrays.<ReactPackage>asList(
45+
new MainReactPackage(),
46+
// other packages
47+
new RNBluetoothStatePackage()); // <-- Add this line
48+
}
49+
}
50+
```
51+
3452
## Usage
3553

54+
The returned states are on both iOS and Android returned as String:
55+
56+
- `on`
57+
- `off`
58+
- `unknown` (currently default value on Android, if other states are returned from the native module)
59+
- `unauthorized`
60+
- `unsupported`
61+
62+
and only on iOS:
63+
64+
- `resetting`
65+
3666
```javascript
3767
import BluetoothState from 'react-native-bluetooth-state';
3868

3969
const stateChangeHandler = bluetoothState => {
40-
// bluetoothState can either be "on", "off", "unknown", "unauthorized" or "unsupported", on iOS also "resetting"
70+
// handle the state
71+
console.info(bluetoothState);
4172
};
4273

4374
// subscribe to changes

0 commit comments

Comments
 (0)