cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
DerekPapworth
Level: Powered On

Offline app - detect off/online via event rather than timer?

I'm building an offline capable app using info from various blogs and examples posted around and all working so far much as expected (although pain to not be able to use savedata/loaddata in browser and Windows!) and I'm using the technique of checking if connection when change(s) made and if so saving to source (Sharepoint) directly then and there but if no connection then save locally on device for later upload/sync. 

 

The question though is that when there's offline data saved locally to be sync'd, most of the examples out there either use a timer to check for connection and when connected then upload .. or .. do a check when starting app to see if locally stored data and connection, then upload. Both of these options have drawbacks but I noticed when testing on an Android device that when I simulate lossing connection by turning on flight mode the Powerapps App itself displays a message showing offline and when I turn off flight mode a message is displayed saying back online so ... 

 

... looks like Powerapps app has a "trigger" when going offline/online so is it possible there's an "event" my app can hook into such that when the connection is lost or reconnected I can use that as a "trigger" to upload offline data rather than having to use a timer to constantly check connection state? In other words is there something like "onConnected" or "onConnectionChange" for a Powerapp?

 

Thanks for any help on this,

 

Derek

1 ACCEPTED SOLUTION

Accepted Solutions
DerekPapworth
Level: Powered On

Re: Offline app - detect off/online via event rather than timer?

@RandyHayes 

 

Thanks for that idea, sounds like a great idea and will check into that.

 

It's interesting that the OnCheck / OnUncheck will when connection is won/lost as does imply that in the background code Powerapps is itself using events to trigger the change .. I'm guessing something like the OnPropertyChanged events in C Sharp and there's a Connection object with Connection as a property etc etc.

 

Anyway thanks for the tip, will defo give that a go

 

Derek

View solution in original post

5 REPLIES 5
Super User
Super User

Re: Offline app - detect off/online via event rather than timer?

@DerekPapworth 

That might be a good one to look for in the Idea forum and vote on, or add one if not there.

 

However, as a quick way to do this...use a Toggle control.

You can set the Default value of the Toggle to Connection.Connected.  Then put your formulas in the OnCheck and OnUncheck actions that will do what is needed when connected or not.  When you are connected, the OnCheck will fire.  When you are not, the UnCheck will.

 

I hope that sparks some ideas.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Community Support Team
Community Support Team

Re: Offline app - detect off/online via event rather than timer?

Hi @DerekPapworth ,

The Event "trigger" just as you mentioned is not supported within PowerApps currently. In addition, there is also no "OnConnected" property or "OnConnectionChange" event property is supported within a PowerApps app.

 

If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

Best regards,

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
DerekPapworth
Level: Powered On

Re: Offline app - detect off/online via event rather than timer?

@RandyHayes 

 

Thanks for that idea, sounds like a great idea and will check into that.

 

It's interesting that the OnCheck / OnUncheck will when connection is won/lost as does imply that in the background code Powerapps is itself using events to trigger the change .. I'm guessing something like the OnPropertyChanged events in C Sharp and there's a Connection object with Connection as a property etc etc.

 

Anyway thanks for the tip, will defo give that a go

 

Derek

View solution in original post

dyee4613
Level 8

Re: Offline app - detect off/online via event rather than timer?

Here's what I did:

 

https://www.youtube.com/results?search_query=powerapps+offline+connectivity&page=&utm_source=opensea...

 

This should get you 60% of the way there.  The issue is if you close out the app it doesn't send the info when you reopen it. 

bboardman
Level: Powered On

Re: Offline app - detect off/online via event rather than timer?

the only issue with this solution is that it only works on the screen you are currently on.  the control won't trigger if it is not on the active screen and you can't trigger it...well, you can in the browser but not in the PowerApps mobile app which is where it is needed for me.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,262)