as

Settings
Sign out
Notifications
Alexa
Amazonアプリストア
AWS
ドキュメント
Support
Contact Us
My Cases
開発
設計と開発
公開
リファレンス
サポート
アクセスいただきありがとうございます。こちらのページは現在英語のみのご用意となっております。順次日本語化を進めてまいりますので、ご理解のほどよろしくお願いいたします。

react-native-netinfo

The react-native-netinfo API allows you to access network connection information.

Installation

Follow the steps below to install react-native-netinfo.

  1. Add the library dependency in your React Native for Vega application's package.json:

    Copied to clipboard.

     "dependencies": {
         ...
         "@amazon-devices/keplerscript-netmgr-lib": "~2.0.0",
         ...
     }
    
  2. Add com.amazon.network.service to [wants.service] in your React Native for Vega app's manifest.toml:

    Copied to clipboard.

          [[wants.service]]
          id = "com.amazon.network.service"
    
  3. Add API permission to [wants.privilege] in your React Native for Vega app's manifest.toml:

    Copied to clipboard.

         [wants]
         [[wants.privilege]]
         id="com.amazon.network.privilege.net-info"
    
  4. Reinstall dependencies using npm install command.

API privileges

To access full API functionality, your app needs the com.amazon.network.privilege.net-info privilege. This privilege must be granted by the user at runtime. Without it, API responses will be limited. To manage privileges:

  • Check the current privilege status using checkPrivilege("com.amazon.network.privilege.net-info").
  • If needed, request user consent by calling requestPrivilege().

For complete details, see the Security Manager API documentation.

Usage

The following code snippet shows how to query network status:

Copied to clipboard.

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);
      }
});

Supported Methods

API 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.

fetch() and refresh() returns NetInfoState to access the network connection information.

Property 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.

Implementation details

Test on the simulator

You can test the network connection on the Vega Virtual Device by running the following commands.

Copied to clipboard.

kepler 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

Additional resources

For information on additonal libraries, see Supported Third-Party Libraries and Services.


Last updated: Oct 03, 2025