A bit of searching let me to the following. On Android, SFML currently generates the following events:
* sf::Event::LostFocus when the main window is destroyed, but the Activity is still active
* sf::Event::MouseLeft when the application needs to "pause"
The pause is clear to me, explained quite well here:
http://developer.android.com/training/basics/activity-lifecycle/pausing.htmlBut I have no idea when the main window is destroyed but the activity keeps being active.
Right now, my application does not handle these events yet. And this caused my application, while not being visible, to drain my phones battery over night.
Now, I could just go into a sf::Window::waitEvent() loop till I get the corresponding "counter" event. But if I look at the code:
https://github.com/SFML/SFML/blob/master/src/SFML/Window/WindowImpl.cpp#L128It seems that waiting for an event still causes the application to live 100x per second. Which does not feel that good for battery life.
So I'm not sure what's the best way to handle is. Just close the application on sf::Event::LostFocus? And "wait-loop" on sf::Event::MouseLeft?