0.1.1 • Published 2 years ago

react-native-wifi-light-phx v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-native-wifi-light-phx

a package interact wifi of PHX

Installation

npm install react-native-wifi-light-phx

Usage

import WifiLight from "react-native-wifi-light-phx";
import {PermissionsAndroid} from 'react-native'
// ...
- With android, before all, must request manifest ACCESS_FINE_LOCATION.
    const granted = await PermissionsAndroid.request(
                PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
                {
                  title: 'Location permission is required for WiFi connections',
                  message:
                    'This app needs location permission as this is required  ' +
                    'to scan for wifi networks.',
                  buttonNegative: 'DENY',
                  buttonPositive: 'ALLOW',
                }
    );
    if(granted == PermissionsAndroid.RESULTS.GRANTED){
        // do something
    }

- Get Current Wifi
- const currentWifi = await WifiLight.getCurrentWifi();
  console.log(currentWifi);

- Only Android
    + Get List Wifi nearby.
    action: WifiLight.getListWifi();
    listener: WifiLight.onDiscoverWifi = (listwifi) => {

    }

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT