Testing Online Connectivity in PowerApps

Developer Support

Premier Developer Consultant Adam Toth shows you how to test the Connection.Connected property in your PowerApps.


Connection.Connected

If you are building a PowerApp with offline capabilities, then it becomes very important to test whether the device has an active internet connection. The sensor function Connection.Connected can be used to test for connectivity – if true, you are connected, false not so much. A common scenario is to check the result of this function in an OnSelect formula. If connected, write or submit to a live data source, if disconnected, write to local collection for submittal later:

OnSelect = If(Connection.Connected, Patch(Contacts, Defaults(Contacts),{Name:"Adam"}), Collect(DraftContacts,{Name:"Adam"}))

While developing your App, it’s somewhat difficult to test this in the web browser in PowerApps Studio, as the Connection.Connected function will usually return TRUE, even if you can’t connect to the internet (unplugged LAN cable, hotel Wifi without accepting terms of use, etc.). Even if you totally disable your network adapters, or put your computer in airplane mode, the property can still be unreliable. Sometimes it reports correctly, sometimes it takes a long time after changing connection status to update in the App, but usually just reports true

Add to this the fact that if you are disconnected to test offline capabilities, then you can’t really make any changes and Save in PowerApps Studio, because, well, you are disconnected, right?

You can read more of Adam’s post here.

0 comments

Discussion is closed.

Feedback usabilla icon