Avikalp Srivastava
Avikalp Srivastava

Reputation: 139

Collect accelerometer readings while an app is suspended

Windows 10 Universal App uses 1-second interval on DispatcherTimer to collect and make deductions on the device's accelerometer readings.

Requirement is that this process should continue even when the user suspends the app (not 'terminated').

One possible solution was Registering with Background Task using time trigger, but it allows a lowest interval of 15 minutes compared to the required 1 second.

Upvotes: 0

Views: 134

Answers (1)

Mamoru Satoh
Mamoru Satoh

Reputation: 2710

You can use the extended execution session. By using this session, you can prevent the app from suspending even if the app go to background. But...this is an important thing... this is a sort of 'best effort' service. OS can 'revoke' your extended execution ANY time.

In my experiences (with my 1GB-memory phone), if you run the only 1-2 apps, the target app can keep running. but, 4-5 apps running, the target app's extended execution are revoked intermittently.

Following links may helps you.

App Lifecycle - Keep Apps Alive with Background Tasks and Extended Execution https://msdn.microsoft.com/en-us/magazine/mt590969

Background activity with the Single Process Model https://blogs.windows.com/buildingapps/2016/06/07/background-activity-with-the-single-process-model/

Upvotes: 1

Related Questions