Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to enable and disable the offline mode automatically from app in react-native

I am trying to enable and disable the offline mode automatically in android using react-native code, I want to know whether is there any possibility like that in react-native, If possible can any one give me suggestions that how can i achieve it. Any help must be much appreciated.

Thank you.

like image 344
Hussian Shaik Avatar asked Dec 09 '25 01:12

Hussian Shaik


1 Answers

Try this link https://www.npmjs.com/package/react-native-system-setting

  import SystemSetting from 'react-native-system-setting'

       SystemSetting.isAirplaneEnabled().then((enable)=>{
        const state = enable ? 'On' : 'Off';
        console.log('Current airplane is ' + state);
    })

    SystemSetting.switchAirplane(()=>{
        console.log('switch airplane successfully');
    })
like image 86
Prabhu Avatar answered Dec 11 '25 16:12

Prabhu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!