Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-native-connectivity-status
Advanced tools
A ReactNative module to check Bluetooth and Location status on Android and iOS
A React Native module to check Bluetooth and Location status on Android and iOS
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
Interactively check Location Services and Bluetooth status
import ConnectivityManager from 'react-native-connectivity-status'
// Check if Location Services are enabled
const locationServicesAvailable = await ConnectivityManager.areLocationServicesEnabled()
// Check Location permission
const locationPermission = await ConnectivityManager.isLocationPermissionGranted()
switch(locationPermission) {
case "Location.Permission.Denied":
// ...
break;
case "Location.Permission.Granted.Always":
// ...
break;
case "Location.Permission.Granted.WhenInUse":
// ...
break;
default:
// ...
}
// Check if Bluetooth is ON
const bluetoothIsOn = await ConnectivityManager.isBluetoothEnabled()
Note: On Android, Location permission state will map on Location.Permission.Denied
and Location.Permission.Granted.Always
only.
Subscribe to updates
import ConnectivityManager from 'react-native-connectivity-status'
const connectivityStatusSubscription = ConnectivityManager.addStatusListener(({ eventType, status }) => {
switch (eventType) {
case 'bluetooth':
console.log(`Bluetooth is ${status ? 'ON' : 'OFF'}`)
break
case 'location':
console.log(`Location Services are ${status ? 'AVAILABLE' : 'NOT available'}`)
break
}
})
...
// Remeber to unsubscribe from connectivity status events
connectivityStatusSubscription.remove()
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 :sparkles: & :heart: by Mattia Panzeri and contributors
FAQs
A ReactNative module to check Bluetooth and Location status on Android and iOS
The npm package react-native-connectivity-status receives a total of 511 weekly downloads. As such, react-native-connectivity-status popularity was classified as not popular.
We found that react-native-connectivity-status demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.