question

Jasonix-8458 avatar image
0 Votes"
Jasonix-8458 asked ColeXia-MSFT commented

iOS App restarts when it comming from background

Hi,

when my App is in the background and i tap on it, so it goes in the foreground, the App restart automatically.
I know Apple kill the session to clean the memory. But my has a timer, like a stoppwatch. And I need the running time when it comes in the foreground.
How can I fix this issue?

Thanks for your help :)

dotnet-xamarin
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ColeXia-MSFT avatar image
0 Votes"
ColeXia-MSFT answered ColeXia-MSFT commented

Hello,

Welcome to Microsoft Q&A!

There is a strict time limit for background task , we only have less 10 minutes(from iOS7) to handle logic .

To register the app to run in the background , your app should be included in the following Categories .

Audio , VoIP , External Accessories and Bluetooth , Newsstand ,Location ,Fetch ,Remote Notifications .

Apple would never allow us to run a single Timer in the background .

As a workaround , I suggest you store the time(into file or something else) before going to background , and get the current time when opening it again , then you will easily get how many time it spent in background .


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for your response.

When I diddnt start the timer, Apple kill my Application as well. How can I fix it?

0 Votes 0 ·

Apple kills the app in 10 minutes if we don't request it for special purpose. Check the Categories I mentioned above .

0 Votes 0 ·