web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Reliably detect SaveDa...
Power Apps
Unanswered

Reliably detect SaveData() and LoadData() availability on app start

(0) ShareShare
ReportReport
Posted on by 313

Hi all,

 

I am developing an app which I want to make work in the browser as well as on-the-go. 

 

There isn't a proper way to detect whether SaveData() and LoadData() are available, and they cause an error if I try to run them on the browser. (I have already posted a idea for improvement in this regard: https://powerusers.microsoft.com/t5/Power-Apps-Ideas/Identify-where-the-app-is-running-with-RunTime-IsBrowser-Runtime/idi-p/403520)

 

It seems that the functions for acceleration, compass and GPS data kinda-sorta work on the browser though, and I am trying to do a hack to indirectly detect whether I can SaveData() and LoadData()

 

Location.Altitude is always Blank on the browser, but it correctly fills with real-time data on devices.

(tested on: Pocophone F1, Samsung Galaxy Tab S3) 

 

I tried to use Location.Altitude on the OnStart() event, however it is blank at that time, all the time, in the tested platforms.


I can sometimes detect it afterwards with a Screen's OnVisible(), but it is unreliable. 
Although rarely, the unreliable event caught the Location.Altitude blank in the OnVisible event. 

 

I would need a way to guarantee that I can get an app variable that is always blank on the web browser, but has a different value on mobile, to be able to avoid SaveData and LoadData, but know when I can use them 100% of the time the platform supports it.

Categories:
I have the same question (0)
  • v-monli-msft Profile Picture
    Microsoft Employee on at

    Hi @TiagoFreire ,

     

    What is your data source? Can you please share the detailed related formulas?

     

    Regards,

    Mona

  • TiagoFreire Profile Picture
    313 on at

    As I said, I tried to read Location.Altitude in the OnStart event and in the OnVisible event of the first screen .

     

    On PC, Location.Altitude is always blank, making for a good candidate to indirectly detect the availability of SaveData() and LoadData().

     

    I used the following logic to test it out:

     

    If(IsBlank(Location.Altitude), Set(hasSaveLoad,false),Set(hasSaveLoad,true))

     

    However...

     

    On devices:

     

    OnStart - hasSaveLoad is always set to false.

    OnVisible - hasSaveLoad is mostly set to true, sometimes set to false. (Not really hard to reproduce, happened several times)

     

    On a button after the app warmed up: hasSaveLoad is always set to true.

     

    Being able to detect the availability of SaveData() and LoadData() at app initial load is very important for a myriad of applications. 

  • TiagoFreire Profile Picture
    313 on at

    UPDATE: If I fully close the PowerApps Runtime and cold start it, it's actually pretty easy to get a FALSE value in the OnVisible event. 

    If I leave the PowerApps runtime open, and just close and reopen the test app from the PowerApps - My Apps screen, it tends to set the variable to true after it read Location.Altitude at least once in the OnVisible event (still not guaranteed though). 

  • TiagoFreire Profile Picture
    313 on at

    UPDATE#2: I did further testing, adding another variable: timerSaveLoad.

     

    I created a Timer in the app which autostarts, and waited 10 miliseconds before triggering: 

     

    If(!IsBlank(Location.Altitude),Set(timerSaveLoad,true),Set(timerSaveLoad,false))
     
    Using a Timer is also an unreliable way to detect the value.
    Sometimes it sets  timerSaveLoad to true, sometimes to false. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard