Check that WIFI is turned on is React Native iOS app











up vote
1
down vote

favorite












Do you know how it is possible to check that WIFI is turned on is React Native iOS app. Due to the aGPS on iOS devices, the WIFI must be turned on in order for our location sensitive app to be able to work effectively and we want to notify the user in cases it is turned off.



Any idea how to achieve this in a React Native app for iOS?










share|improve this question


























    up vote
    1
    down vote

    favorite












    Do you know how it is possible to check that WIFI is turned on is React Native iOS app. Due to the aGPS on iOS devices, the WIFI must be turned on in order for our location sensitive app to be able to work effectively and we want to notify the user in cases it is turned off.



    Any idea how to achieve this in a React Native app for iOS?










    share|improve this question
























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      Do you know how it is possible to check that WIFI is turned on is React Native iOS app. Due to the aGPS on iOS devices, the WIFI must be turned on in order for our location sensitive app to be able to work effectively and we want to notify the user in cases it is turned off.



      Any idea how to achieve this in a React Native app for iOS?










      share|improve this question













      Do you know how it is possible to check that WIFI is turned on is React Native iOS app. Due to the aGPS on iOS devices, the WIFI must be turned on in order for our location sensitive app to be able to work effectively and we want to notify the user in cases it is turned off.



      Any idea how to achieve this in a React Native app for iOS?







      ios react-native wifi






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 7 at 16:54









      Va5ili5

      8810




      8810
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          Use NetInfo to check if the device is connected to wifi/cellular in React Native.




          NetInfo exposes info about online/offline status




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


          ConnectionType describes the type of connection the device is using to communicate with the network.



          Cross platform values for ConnectionType:



          none - device is offline
          wifi - device is online and connected via wifi, or is the iOS simulator
          cellular - device is connected via Edge, 3G, WiMax, or LTE
          unknown - error case and the network status is unknown


          For more please visit https://facebook.github.io/react-native/docs/netinfo






          share|improve this answer

















          • 1




            I think what he means is if there is a way to check if wifi is open in order to have AGPS signal while the device is connected via cellular 3G/4G
            – Giorgos Kartalis
            Nov 8 at 12:40










          • Indeed most of the time users would be driving and would not be connected to a wifi router. Nonetheless, an iOS device's aGPS requires the wifi to be turned on (even though not connected but must not be disabled). What I need is to know if it is turned on or off not to know that I am connected through 4G.
            – Va5ili5
            Nov 8 at 16:57











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53194187%2fcheck-that-wifi-is-turned-on-is-react-native-ios-app%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote













          Use NetInfo to check if the device is connected to wifi/cellular in React Native.




          NetInfo exposes info about online/offline status




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


          ConnectionType describes the type of connection the device is using to communicate with the network.



          Cross platform values for ConnectionType:



          none - device is offline
          wifi - device is online and connected via wifi, or is the iOS simulator
          cellular - device is connected via Edge, 3G, WiMax, or LTE
          unknown - error case and the network status is unknown


          For more please visit https://facebook.github.io/react-native/docs/netinfo






          share|improve this answer

















          • 1




            I think what he means is if there is a way to check if wifi is open in order to have AGPS signal while the device is connected via cellular 3G/4G
            – Giorgos Kartalis
            Nov 8 at 12:40










          • Indeed most of the time users would be driving and would not be connected to a wifi router. Nonetheless, an iOS device's aGPS requires the wifi to be turned on (even though not connected but must not be disabled). What I need is to know if it is turned on or off not to know that I am connected through 4G.
            – Va5ili5
            Nov 8 at 16:57















          up vote
          1
          down vote













          Use NetInfo to check if the device is connected to wifi/cellular in React Native.




          NetInfo exposes info about online/offline status




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


          ConnectionType describes the type of connection the device is using to communicate with the network.



          Cross platform values for ConnectionType:



          none - device is offline
          wifi - device is online and connected via wifi, or is the iOS simulator
          cellular - device is connected via Edge, 3G, WiMax, or LTE
          unknown - error case and the network status is unknown


          For more please visit https://facebook.github.io/react-native/docs/netinfo






          share|improve this answer

















          • 1




            I think what he means is if there is a way to check if wifi is open in order to have AGPS signal while the device is connected via cellular 3G/4G
            – Giorgos Kartalis
            Nov 8 at 12:40










          • Indeed most of the time users would be driving and would not be connected to a wifi router. Nonetheless, an iOS device's aGPS requires the wifi to be turned on (even though not connected but must not be disabled). What I need is to know if it is turned on or off not to know that I am connected through 4G.
            – Va5ili5
            Nov 8 at 16:57













          up vote
          1
          down vote










          up vote
          1
          down vote









          Use NetInfo to check if the device is connected to wifi/cellular in React Native.




          NetInfo exposes info about online/offline status




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


          ConnectionType describes the type of connection the device is using to communicate with the network.



          Cross platform values for ConnectionType:



          none - device is offline
          wifi - device is online and connected via wifi, or is the iOS simulator
          cellular - device is connected via Edge, 3G, WiMax, or LTE
          unknown - error case and the network status is unknown


          For more please visit https://facebook.github.io/react-native/docs/netinfo






          share|improve this answer












          Use NetInfo to check if the device is connected to wifi/cellular in React Native.




          NetInfo exposes info about online/offline status




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


          ConnectionType describes the type of connection the device is using to communicate with the network.



          Cross platform values for ConnectionType:



          none - device is offline
          wifi - device is online and connected via wifi, or is the iOS simulator
          cellular - device is connected via Edge, 3G, WiMax, or LTE
          unknown - error case and the network status is unknown


          For more please visit https://facebook.github.io/react-native/docs/netinfo







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 7 at 16:58









          Sateesh

          1,300615




          1,300615








          • 1




            I think what he means is if there is a way to check if wifi is open in order to have AGPS signal while the device is connected via cellular 3G/4G
            – Giorgos Kartalis
            Nov 8 at 12:40










          • Indeed most of the time users would be driving and would not be connected to a wifi router. Nonetheless, an iOS device's aGPS requires the wifi to be turned on (even though not connected but must not be disabled). What I need is to know if it is turned on or off not to know that I am connected through 4G.
            – Va5ili5
            Nov 8 at 16:57














          • 1




            I think what he means is if there is a way to check if wifi is open in order to have AGPS signal while the device is connected via cellular 3G/4G
            – Giorgos Kartalis
            Nov 8 at 12:40










          • Indeed most of the time users would be driving and would not be connected to a wifi router. Nonetheless, an iOS device's aGPS requires the wifi to be turned on (even though not connected but must not be disabled). What I need is to know if it is turned on or off not to know that I am connected through 4G.
            – Va5ili5
            Nov 8 at 16:57








          1




          1




          I think what he means is if there is a way to check if wifi is open in order to have AGPS signal while the device is connected via cellular 3G/4G
          – Giorgos Kartalis
          Nov 8 at 12:40




          I think what he means is if there is a way to check if wifi is open in order to have AGPS signal while the device is connected via cellular 3G/4G
          – Giorgos Kartalis
          Nov 8 at 12:40












          Indeed most of the time users would be driving and would not be connected to a wifi router. Nonetheless, an iOS device's aGPS requires the wifi to be turned on (even though not connected but must not be disabled). What I need is to know if it is turned on or off not to know that I am connected through 4G.
          – Va5ili5
          Nov 8 at 16:57




          Indeed most of the time users would be driving and would not be connected to a wifi router. Nonetheless, an iOS device's aGPS requires the wifi to be turned on (even though not connected but must not be disabled). What I need is to know if it is turned on or off not to know that I am connected through 4G.
          – Va5ili5
          Nov 8 at 16:57


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53194187%2fcheck-that-wifi-is-turned-on-is-react-native-ios-app%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Tangent Lines Diagram Along Smooth Curve

          Yusuf al-Mu'taman ibn Hud

          Zucchini