Android: fix crash if app restarted in background