0

Im looking for the library in RN community that can help me manage my active wifi connection. I would like to connect/disconnect to certain wifi networks.

The equivalent class in Java is: https://developer.android.com/reference/android/net/ConnectivityManager

Irrevocable
  • 39
  • 1
  • 6

1 Answers1

0

NetInfo may solve your problem. Here is an example Find more here https://facebook.github.io/react-native/docs/netinfo

import {NetInfo} from 'react-native';

NetInfo.getConnectionInfo().then((connectionInfo) => {
  console.log(
    'Initial, type: ' +
      connectionInfo.type +
      ', effectiveType: ' +
      connectionInfo.effectiveType,
  );
});
function handleFirstConnectivityChange(connectionInfo) {
  console.log(
    'First change, type: ' +
      connectionInfo.type +
      ', effectiveType: ' +
      connectionInfo.effectiveType,
  );
  NetInfo.removeEventListener(
    'connectionChange',
    handleFirstConnectivityChange,
  );
}
NetInfo.addEventListener('connectionChange', handleFirstConnectivityChange);
Aravind Vemula
  • 1,571
  • 17
  • 22