← Back to team overview

ubuntu-phone team mailing list archive

How to check if internet is connected

 

Hi!

I am writing a very simple utility in which I need to check if a network
connection is currently established or not. For example if wifi or data
connection is connected. At the same time I would also like to know if I
can use a signal for change in network connectivity e.g. when wifi is
connected/disconnected or when data connection is connected/disconnected.

Right now I only care about the connection establishment and not really
about if there is internet connectivity. I can of course check that by
pinging a server

Any code samples would help largely.

Thanks!

Follow ups