Simplest Way to Get Net Info in React Native | Checking Wi-Fi and Mobile Data Connections

Поделиться
HTML-код
  • Опубликовано: 6 ноя 2024

Комментарии • 31

  • @mashschool
    @mashschool  4 года назад +1

    If you have any questions about this or request tutorials in this style, be sure to leave a comment below the video, and thank you for liking it. 😉

    • @abhisekhsahoo5880
      @abhisekhsahoo5880 3 года назад

      I'm using react-native v0.63 and react hooks for implementing this but it is not recognizing helper function in
      NetInfo.addEventListener(state => {
      console.log("Connection type", state.type);
      console.log("Is connected?", state.isConnected);
      });
      Full code:
      import {useState, useEffect} from 'react';
      import NetInfo from '@react-native-community/netinfo';
      let currentNetwork;
      NetInfo.fetch().then(state => {
      currentNetwork = state.isConnected;
      });
      const CheckConnection = () => {
      const [netInfo, setNetInfo] = useState(currentNetwork);
      useEffect(() => {
      const unsubscribe = NetInfo.addEventListener(state => {
      setNetInfo(state.isConnected);
      });
      return unsubscribe;
      }, []);
      return netInfo;
      };
      export default CheckConnection;

    • @mohammadzeeshan6890
      @mohammadzeeshan6890 3 года назад

      Hi Mash I tried on android and it worked. I know there are issues in while running on iOS simulator, but it isnt working for iOS device as well. App has to be re opened for it to work. What could be the problem?

    • @celdan714
      @celdan714 2 года назад

      Hi Mash! Thanks for your video turorial. I have a question. I´m wondering if the deatils strength would have realtion with rssi signal

  • @ajaykumar-nx7kb
    @ajaykumar-nx7kb 3 года назад

    Nice explanation, I resolved network problem as well as get ip address. Thank you ❤

  • @giorgospapadopoulos2578
    @giorgospapadopoulos2578 3 года назад

    Very helpful and informative. Thank you!!

  • @priyaranjan1733
    @priyaranjan1733 3 года назад

    Thanks :) It's really helpful. I also liked that you summarized all at the end :P

  • @kabilans3877
    @kabilans3877 3 года назад

    Most Valuable video 👍

  • @josecaraballo3349
    @josecaraballo3349 3 года назад

    Excellent explanation, thank you very much, how can I know the quality or bandwidth of the internet connection?

    • @mashschool
      @mashschool  3 года назад +1

      Using the react-native-network-bandwidth-speed module, you can see the network bandwidth in result.
      www.npmjs.com/package/react-native-network-bandwith-speed

    • @josecaraballo3349
      @josecaraballo3349 3 года назад

      @@mashschool Thank you very much.

  • @deepapalani5114
    @deepapalani5114 2 года назад

    I have tried this example and it's working fine. I want to check internet connection not only in particular page. I want to make it check all over the application. How can i achieve it please help me

  • @i.carolinaperezflores523
    @i.carolinaperezflores523 3 года назад

    Thank you!!

  • @tanmaymishra4826
    @tanmaymishra4826 3 года назад

    clear understand

  • @AraChinaryan
    @AraChinaryan 3 года назад

    Thank you

  • @MAGacailandia
    @MAGacailandia 3 года назад

    Ser a que existe um pacote para Alterar IP da Rede?

  • @Asyrafcruz
    @Asyrafcruz 2 года назад

    How secure is this library

  • @Kiwiranto
    @Kiwiranto 3 года назад

    I using this in my project but when I run in ios the "ssid" value always return null, can you help me why ?

    • @mashschool
      @mashschool  3 года назад

      On iOS, make sure your app meets at least one of the following requirements:
      developer.apple.com/documentation/systemconfiguration/1614126-cncopycurrentnetworkinfo?language=objc#discussion

  •  3 года назад

    How can I make the application connect to a new network?

    • @mashschool
      @mashschool  3 года назад

      You can use this module : www.npmjs.com/package/react-native-wifi-reborn

    •  3 года назад

      @@mashschool Thanks. Congratulations for video.

  • @vijaymuruganandham3691
    @vijaymuruganandham3691 3 года назад

    i am not able implement this code in functional component

    • @mashschool
      @mashschool  3 года назад +1

      There is no problem in using this module in functional components. This link may help you:
      stackoverflow.com/questions/62787980/how-do-i-access-reusable-netinfo-code-from-function-component-to-class-component

  • @Toojool
    @Toojool 2 года назад

    there is programming with mosh and now programming with mash. Both persian lol

  • @allencarcamo3461
    @allencarcamo3461 3 года назад

    this app give free inernet