In my android application I am querying a database. I am only able to query the database if the phone is connected to the internal network, i.e: by being connected to company WiFi, or by using VPN connection.
I would like to check this connection first – maybe by trying to ‘ping’ the server first? Is this possible?
Thanks.
Just try to connect to the network/database/ip and handle any exception thrown b/c the network is unreachable or b/c of a time out.
You can also try InetAddress which has an isReachable() method.