cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
seadude
Level 10

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
PowerApps Staff Mr-Dang-MSFT
PowerApps Staff

Re: How to run PowerApps in the background?

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
PowerApps Staff Mr-Dang-MSFT
PowerApps Staff

Re: How to run PowerApps in the background?

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

seadude
Level 10

Re: How to run PowerApps in the background?

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
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,881)