So I’ve made myself a small “incremental game”.
Note: For those who are not familiar, you click on a button and it increases a value, a currency of sorts. You buy upgrades to autogenerate this currency after you’ve laboriously made enough by clicking/tapping manually, saving you the cost of buy a new mouse. Or a new phone, in this case.
Now, I’ve been testing around with it. New to Ionic and all. I’ve realized that on the android (I did Ionic run android), if I hit the native “back” button on the phone, it pauses the app completely. My autogenerating is suspended. That’s fine and all! It’s intended after all.
The issue/problem comes when I hit the native home button. Which brings me to the home screen on an android as well as when my phone auto sleeps. The feature that is intended to save battery life. Whenever either of this happens, the autogenerating continues in the background.
Coming from native android, java. I understand there’s a lifecycle to apps. How is Ionic’s like? And does it go into different states depending on method of exiting the app?
Extra info: I’m currently using $interval to keep the game’s main loop running. I autogen my currency once per second as well as save it into an sqlite database right after. (Both running at once per second).
EDIT1: I have no plugins installed! Using only services.