kzahel
kzahel

Reputation: 2785

Chrome app "onSuspend" being called, why?

According to Google's app lifecycle docs

When the event page has no executing JavaScript, no pending callbacks, and no open windows, the runtime unloads the event page and closes the app.

I am seeing in my app that an onSuspend is being triggered, which also has the side effect of invalidating any FileEntry or DirectoryEntry references (an as-of-yet undocumented "feature"), only the onSuspend is triggered when I still have pending callbacks and open windows. Does anybody know which other conditions will trigger an onSuspend? Does it have to do with the app using too much memory?

It makes sense that onSuspend will be called when the event/background page has no activity and there are no windows open, but when else would onSuspend be called?

Is there a secret permission that I can use to disable onSuspend from being called? A background permission API in the works?

Upvotes: 0

Views: 158

Answers (1)

Ben Wells
Ben Wells

Reputation: 1892

It should not be triggered if you have open windows unless something atypical is under way, like the user upgrading chrome.

If you are seeing onSuspend events at other times, that sounds like a bug. Please report at crbug.com with steps to reproduce.

Upvotes: 2

Related Questions