On android>8.0
I need a shared variable on all activites. Then I declareted this variable on Starter service.
My problem: If the app go to background and I run many others apps the OS seems destroy the service (no log). When I run my app again Service_Create is called but all public variable on "Sub process_Globals" are initializated again.
I read a lot of threads but maybe I don't understood correctly.
My workaround:
1) On all Activities (Pause event) I write a game state to a map and save this map to file.
2) On Service_Create I read this map and recover all values.
It work but seems weird. How can I do this better?
Thank you.