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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,219)