react-native-netinfo
With the react-native-netinfo API, you can access network connection information. The Vega-ported version of this library has a different package name: keplerscript-netmgr-lib.
Installation
Follow these steps to install keplerscript-netmgr-lib.
- Add the library dependency in your React Native for Vega application's
package.json:"dependencies": { ... "@amazon-devices/keplerscript-netmgr-lib": "~2.0.0", ... } - Add
com.amazon.network.serviceto[wants.service]in your React Native for Vega app'smanifest.toml:[[wants.service]] id = "com.amazon.network.service" - Add API permission to
[wants.privilege]in your React Native for Vega app'smanifest.toml:[wants] [[wants.privilege]] id="com.amazon.network.privilege.net-info" - Reinstall dependencies using the
npm installcommand.
API privileges
To access full API functionality, your app needs the com.amazon.network.privilege.net-info privilege. The user must grant this privilege at runtime. Without it, API responses are limited.
To manage privileges:
- Check the current privilege status using
checkPrivilege("com.amazon.network.privilege.net-info"). - Request user consent by calling
requestPrivilege(), if needed.
For complete details, see the Security Manager API documentation.
Usage
The following code example shows how to query network status:
import {NetInfoStateType, fetch} from "@amazon-devices/keplerscript-netmgr-lib";
fetch().then(state => {
console.log("is connected? " + state.isConnected);
if (state.type === NetInfoStateType.wifi) {
console.log("ssid is " + state.details.ssid);
}
});
Methods
| Method | Description |
|---|---|
fetch() |
Returns cached network information. |
refresh() |
Updates network state and returns network information. |
addEventListener() |
Listens for network connection changes. |
useNetInfo() |
Gets access to the latest state from the global instance. |
The fetch() and refresh() methods return NetInfoState to access the network connection information.
Props
| Prop | Description |
|---|---|
type |
NetInfoStateType.wifi if the connection is Wi-Fi. |
isConnected |
true if Wi-Fi is connected; otherwise false. |
isInternetReachable |
true if the internet is reachable; otherwise false. |
ssid in details |
The SSID of the connected access point. "<unknown ssid>" returned if com.amazon.network.privilege.net-info privilege is denied. |
bssid in details |
The BSSID of the connected access point."02:00:00:00:00:00" returned if com.amazon.network.privilege.net-info privilege is denied. |
strength in details |
The signal strength of the current Wi-Fi connection. |
ipAddress in details |
The IP address. |
subnet in details |
The subnet mask. |
frequency in details |
The center frequency. |
linkspeed in details |
The link speed in bps of the current connection. |
isConnectionExpensive in details |
true if the connection is expensive; otherwise false. |
Known issues and limitations
Test on the simulator
You can test the network connection on the Vega Virtual Device by running the following commands.
vega exec vda shell
ace mw wifi_cli add_network ssid=test psk=test_password
ace mw wifi_cli connect test
Supported versions
| Package version | @amazon-devices/react-native-kepler version |
|---|---|
| 2.0.x | 2.0.x+rn0.72.0 |
Related topics
For information on other libraries, see Supported Third-Party Libraries and Services.
Last updated: Oct 22, 2025

