Get started with offline apps in Power Apps Microsoft Office 365, Microsoft Power Apps loadingscreen

When you use Power Apps in SharePoint Online in the office you will probably not be too worried about making your app work in offline mode. What if you get started using your app on your mobile?

Need for offline apps

If you have field engineers travelling to locations with their mobile devices? Do they have a wifi or a mobile data connection available? The problem here is that they may not have the option to update the databases used by your app.

In this post I’m looking at the first steps of creating offline apps.

Connected or not

The first step is the Connection Object.

Connection.Connected  will tell you if your app is online or if it is offline. In the below example I’m checking the connection status and displaying a text depending on if the app is connected or not.

If(Connection.Connected, "Connected", "Offline")
Identifying Connected  or Offline apps Power Apps

Similar things can also be done to find out if you are on a metered connection or not.

If(Connection.Metered, "Metered", "Unlimited")
MEtered

To make this all look a bit better you could of course also use smile faces.

Smile

For an unhappy face you could use !Connection.Connected in the visibility settings for icon and maybe use a neutral face if you have a metered connection.

Saving your data with SaveData

When you are connected, things will just work and we don’t need to worry too much about being connected. If there is no connection however it will be important to store the data temporarily on your mobile device.

There are two functions that will help with this.

  • LoadData
  • SaveData

When you try to save a form you could have something as shown below. Where you first check the connection and then store the data locally using the SaveData function.

SaveData function in Power Apps

When using this on a mobile devices and you don’t have a connection the Title will be stored on the device for later use.

Getting your data back with LoadData

Now when you’re loading the app you can collect the same data using a LoadData function

Loading Screen using LoadData function

In the above example I set my default value for the title to the variable OfflineTitle.

Now that we have  looked at the basics of offline apps in PowerApps, it will be time to look at more detailed real life examples where the amount of data is larger. I will write about that in one of my future posts.

Avatar for Pieter Veenstra

By Pieter Veenstra

Business Applications Microsoft MVP working as the Head of Power Platform at Vantage 365. You can contact me using contact@sharepains.com

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from SharePains by Microsoft MVP Pieter Veenstra

Subscribe now to keep reading and get access to the full archive.

Continue reading