cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Super User
Super User

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
Highlighted
Power Apps
Power Apps

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
Highlighted
Power Apps
Power Apps

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

Highlighted
Super User
Super User

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
Check this Out

Announcing

Class of 2020- Season 2

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,802)