<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=612681139262614&amp;ev=PageView&amp;noscript=1">
Skip to content

Need help? Talk to an expert: phone(904) 638-5743

Power Apps Disconnected and Offline Mode

Power Apps Disconnected and Offline Mode

powerappslogoEver been offline or off the grid with no Internet/WIFI access but want to send data to your database? In this post I’ll show you how to use Power Apps to create a data-driven application that might occasionally be disconnected from the network or be offline. With this application you can cache locally on a phone and when it receives internet access again, it will automatically send that data to the database.

Be sure to watch my video where I’ll demo how to build this app and a simulation of how it works. But here’s a breakdown:

  • I start in Power Apps and I create an app with three columns. One for data offline, one for data online and one where I create my task and can toggle between online and offline.
  • If you’ve seen any of my other Power Apps posts, you’ll know that you’ll use variables to show what is visible on my app. So, if the toggle is set to ‘true’ then I’d see the data offline section would be visible. If the toggle is ‘false’ we’d see the data online section.
  • The toggle is there so I can simulate being on/offline for this demo. It’s also great to have this during development of the app to toggle manually and test the process of the app. I can remove or hide this once I’m done.
  • More importantly at the bottom of the Create Project section is a box that shows my connection state (connected true if we are connected live).
  • When I click on to see the text from this box, I see a property called connection. When I put the connection property (connection.connected) in my code bar it will tell me whether I am presently connected (true or false).
  • The data online section is pulling from a SQL Server table called Project Types. The data offline section is pulling from a collection of data called colOffline.
  • When I hit create project you’ll see that I’ve created some If/Then statements. If that toggle is set to true (I’m online), I’m going to patch that record into the Project Type table. If the toggle is false (I’m offline), then I’ll do a collection (colOffline file).
  • In this case, my table is simple with an identity table already inside that, so it’s taken care of by SQL Server. If you check out my video below, I’ve also written out the code for all this in the description text under the video.
  • Next, I need a way to show that when I’m online again, that data can be taken from the cache and put into my database.
  • To do this, I’ll put an event on the OnCheck. The OnCheck will recognize that something has changed and if that offline collection has any data in it, then I’ll go through each record in that collection and patch it into my database. Once I’m done, I’ll clear the collection. Again, I’m doing all this as a simulation to show how this app is built and how it is working but it’s really meant to work on your phone while you’re out and about with no internet access.
  • When using this app on a phone that data is stored in a temporary location on the phone in the Power Apps application space. As soon as it goes online it will automatically do that patch for us.

This works great for companies that may be out in a remote part of the world or for someone who works on an airplane and they want to do all their flight paperwork in the air and once landed, that data will be streamed up. As long as you have that application open then you can be assured that the data you input while offline will be sent to the database once you’re back online again.

Want to learn more Power Apps? Our On-Demand Learning platform contains Power Apps courses, as well as courses covering all the tools in the Power Platform – as part of our 55+ course catalog covering Business Intelligence, Data Analytics, Azure and more. If you need apps built for you, we can also help with that. With our Shared Development offering we’ll set you up with a developer for the time you need at a fraction of the cost of hiring a full-time developer. Click below to learn more.

Sign-up now and get instant access

Leave a comment

Free Trial

On-demand learning

Most Recent

private training

Hackathons, enterprise training, virtual monitoring