Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
myfave-react-native-android-wifi
Advanced tools
Readme
A react-native module for viewing and connecting to Wifi networks on Android devices.
npm install react-native-android-wifi --save
Use react-native link to install native dependencies automatically:
react-native link
or do it manually as described here.
var wifi = require('react-native-android-wifi')
Wifi connectivity status:
wifi.isEnabled((isEnabled) => {
if (isEnabled) {
console.log("wifi service enabled");
} else {
console.log("wifi service is disabled");
}
});
Enable/Disable wifi service:
//Set TRUE to enable and FALSE to disable;
wifi.setEnabled(true);
Sign device into a specific network:
This method doesn't have a callback when connection succeeded, check this issue.
//found returns true if ssid is in the range
wifi.findAndConnect(ssid, password, (found) => {
if (found) {
console.log("wifi is in range");
} else {
console.log("wifi is not in range");
}
});
Disconnect current wifi network
wifi.disconnect();
Get current SSID
wifi.getSSID((ssid) => {
console.log(ssid);
});
Get current BSSID
wifi.getBSSID((bssid) => {
console.log(bssid);
});
Get all wifi networks in range
/*
wifiStringList is a stringified JSONArray with the following fields for each scanned wifi
{
"SSID": "The network name",
"BSSID": "The address of the access point",
"capabilities": "Describes the authentication, key management, and encryption schemes supported by the access point"
"frequency":"The primary 20 MHz frequency (in MHz) of the channel over which the client is communicating with the access point",
"level":"The detected signal level in dBm, also known as the RSSI. (Remember its a negative value)",
"timestamp":"Timestamp in microseconds (since boot) when this result was last seen"
}
*/
wifi.loadWifiList((wifiStringList) => {
var wifiArray = JSON.parse(wifiStringList);
console.log(wifiArray);
},
(error) => {
console.log(error);
}
);
connectionStatus returns true or false depending on whether device is connected to wifi
wifi.connectionStatus((isConnected) => {
if (isConnected) {
console.log("is connected");
} else {
console.log("is not connected");
}
});
Get connected wifi signal strength
//level is the detected signal level in dBm, also known as the RSSI. (Remember its a negative value)
wifi.getCurrentSignalStrength((level) => {
console.log(level);
});
Get connected wifi frequency
wifi.getFrequency((frequency) => {
console.log(frequency);
})
Get current IP
//get the current network connection IP
wifi.getIP((ip) => {
console.log(ip);
});
Remove/Forget the Wifi network from mobile by SSID, returns boolean
wifi.isRemoveWifiNetwork(ssid, (isRemoved) => {
console.log("Forgetting the wifi device - " + ssid);
});
Starts native Android wifi network scanning and returns list
wifi.reScanAndLoadWifiList((wifiStringList) => {
var wifiArray = JSON.parse(wifiStringList);
console.log('Detected wifi networks - ',wifiArray);
});
Method to force wifi usage. Android by default sends all requests via mobile data if the connected wifi has no internet connection.
//Set true/false to enable/disable forceWifiUsage.
//Is important to enable only when communicating with the device via wifi
//and remember to disable it when disconnecting from device.
wifi.forceWifiUsage(true);
FAQs
A react-native implementation for viewing and connecting to Wifi networks on Android devices.
The npm package myfave-react-native-android-wifi receives a total of 2 weekly downloads. As such, myfave-react-native-android-wifi popularity was classified as not popular.
We found that myfave-react-native-android-wifi demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.