
Security News
NIST Under Federal Audit for NVD Processing Backlog and Delays
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
rn-hardware-info
Advanced tools
A backend API that retrieves peformance information of hardware to React Native Apps
npm i rn-hardware-info
in the project directoryMostly automatic installation(autolinking from RN 0.60 and later versions)
$ react-native link rn-hardware-info
import RnHardwareInfo from 'rn-hardware-info';
Wifi Usage Permission:
MainView.checkWifiUsagePermission((permsn_cb) => {
#your code on how to use permsn_cb
})
// get cpu frequency
RnHardwareInfo.getDeviceCpuFreqNow((cpu_cb) => {
#your code on how to use cpu_cb
})
// get ram usage
RnHardwareInfo.getDeviceMemInfo((ram_cb) => {
#your code on how to use ram_cb
})
// get battery temperature
RnHardwareInfo.getBatteryTemperature((temp_cb) => {
#your code on how to use temp_cb
})
// get network stats
RnHardwareInfo.getNetworkStats((down_cb, up_cb) => {
#your code on how to use down_cb and up_cb
})
Run npm i rn-hardware-info
in the project directory
Run pod install
in the ios directory
Mostly automatic installation(autolinking from RN 0.60)
$ react-native link rn-hardware-info
RnHardwareInfo.getAppUsage((error, usage) => {
if (error) {
console.log(error);
} else {
console.log(usage.cpu_usage);
console.log(usage.memory_usage);
console.log(usage.download_speed);
console.log(usage.upload_speed);
}
});
import React, {useState, useEffect} from 'react';
import RnHardwareInfo from 'rn-hardware-info';
//Display hardware info eg. cpu
const DeviceInfo = () => {
const [cpu, setCpu] = useState('0');
useEffect(() => {
const interval = setInterval(() => {
if (RnHardwareInfo != null) {
RnHardwareInfo.getAppUsage((error, usage) => {
if (error) {
console.log(error);
} else {
console.log('get app usage');
console.log(usage);
setCpu(usage.cpu_usage);
}
});
}
}, 1000);
return () => clearInterval(interval);
}, []);
return (
<View style={styles.container}>
<Text> CPU Usage: {cpu}%</Text>
</View>
);
};
FAQs
A backend API that retrieves peformance information of hardware to React Native Apps
The npm package rn-hardware-info receives a total of 3 weekly downloads. As such, rn-hardware-info popularity was classified as not popular.
We found that rn-hardware-info demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Security News
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
Research
Security News
Socket’s Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.
Security News
TypeScript Native Previews offers a 10x faster Go-based compiler, now available on npm for public testing with early editor and language support.