How to check internet is disconnected but VPN connected in react native app

474 Views Asked by At

I connected to the internet and then connect to VPN now, I disconnected the internet and checked the network connectivity status in my application, and I am getting connected to netinfo. Can anyone help to know how can we know if the internet is connected or not when VPN is connected?

1

There are 1 best solutions below

0
On

You can use this package https://github.com/kzlsnn/react-native-vpn-detect

import Security from "react-native-vpn-detect";

async function checkSecurity() {
    let detectVPN = await Security.detectVPN().then(response => { return response });
    let detectProxy = await Security.detectProxy().then(response => { return response });
}
checkSecurity();