React-native-connectivity-status
A React Native module to check Bluetooth and Location status on Android and iOS
Getting started
Add react-native-connectivity-status
module to your project
$ yarn add react-native-connectivity-status
And link it
$ react-native link react-native-connectivity-status
Usage
Check Status
Interactively check Location Services and Bluetooth status
// Check if Location Services are enabledconst locationServicesAvailable = await ConnectivityManager // Check Location permissionconst locationPermission = await ConnectivityManager // Check if Bluetooth is ONconst bluetoothIsOn = await ConnectivityManager
Note: On Android, Location permission state will map on Location.Permission.Denied
and Location.Permission.Granted.Always
only.
Subscribe to updates
const connectivityStatusSubscription = ConnectivityManager...// Remeber to unsubscribe from connectivity status eventsconnectivityStatusSubscription
Enable services
NOTE: Due to possible app rejection from Apple (caused by illegal usage of private URL Scheme "prefs:root" or "App-Prefs:root"), methods for enabling bluetooth and location services have been removed from this module.
Made with ✨ & ❤️ by Mattia Panzeri and contributors