cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
seadude
Memorable Member
Memorable Member

How to run PowerApps in the background?

Hello,

I'm building an app that will track my walks and such. Unfortunately, when my phone goes to sleep, PowerApps is closed, home button pushed, phone turned off, etc... my GPS tracking ends.

What are some strategies for handling this?

We need a trigger built into the application that can see a "sleep/close" of the application so that we can SaveData/LoadData.

Example:

  • Start Timer
  • If App.Sleep, SaveData()
  • If App.Wake, LoadData()

Any other ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
Mr-Dang-MSFT
Power Apps
Power Apps

Hi @seadude,

This is an interesting idea and would be useful for scenarios where other actions could continue if the mobile were in sleep mode.

 

I gave it some thought and I don't think you could detect an event like the phone going to sleep.

 

Here's some of my thoughts:

  • Use a repeating timer to and make it perform an action OnTimerEnd. Problem is how to detect if that action was not performed.

What I would recommend is to save periodically and have an indicator that shows when the last save was so the user can take action to save before the mobile goes to sleep.

View solution in original post

2 REPLIES 2
Mr-Dang-MSFT
Power Apps
Power Apps

Hi @seadude,

This is an interesting idea and would be useful for scenarios where other actions could continue if the mobile were in sleep mode.

 

I gave it some thought and I don't think you could detect an event like the phone going to sleep.

 

Here's some of my thoughts:

  • Use a repeating timer to and make it perform an action OnTimerEnd. Problem is how to detect if that action was not performed.

What I would recommend is to save periodically and have an indicator that shows when the last save was so the user can take action to save before the mobile goes to sleep.

View solution in original post

Gotcha. I am using a repeating timer in this particular app. OnTimerEnd, Lat/Long (and a WHOLE bunch of other data) are written to Azure SQL. I'm still testing what happens when the screen goes to sleep/app is closed/home button is pressed/phone is turned off while the timer is running. It appears the writes to SQL just cease. This is the issue.

I really like your idea for showing a "last saved" label.

My iPhone has many signals that show when its is locked/asleep/etc.

For anyone interested in looking at the data their iPhone is capturing:

  • Click Settings
  • Click Privacy
  • Scroll to bottom, click Analytics
  • Click Analytics Data
  • Peruse these logs! Very interesting!

There are parameters like "ScreenIsLocked", "TimeSinceLastLock", "DeviceIsPowered" etc that would be HUGELY beneficial for us to be able to tap with PowerApps. 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (59,970)