Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Have Amazon Appstore webapp exit on suspend?

We have an app as part of the Amazon Appstore webapp program, which allows web-apps to natively appear in their Appstore on e.g. Kindle Fire HDX. Our problem: The app doesn't exit and clear when closed, it's eternally stored in some persistent cache, causing issues with our concept of user sessions, websockets, remote user syncing and so on (it's a massively-multiplayer virtual world). How can we force the app to properly clear itself when being closed by the user?

(In XCode settings, a comparable boolean would be "UIApplicationExitsOnSuspend"...)

like image 549
Philipp Lenssen Avatar asked Dec 29 '25 19:12

Philipp Lenssen


1 Answers

my initial suggestion was to use the PageVisibility API http://www.w3.org/TR/page-visibility/ (as suggested here Is there a way to detect if a browser window is not currently active?) but it looks like it also requires some more robust checking taking advantage of window.onblur as well per your own comment above

if (isKindle) { window.onblur = window.onpagehide = function(e) { /* doStuff(); */ }; } 
like image 168
Offbeatmammal Avatar answered Jan 04 '26 19:01

Offbeatmammal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!