Page 1 of 1

How to cleanly exit game on Android

Posted: Sat Jan 23, 2016 6:47 pm
by Kasperelo
When I exit my android game, the music still plays. I've tried adding something like:

Code: Select all

function love.focus(inFocus)
    if not inFocus then
        game.exit()
    end
end
... where game.exit() stops all playing sounds and saves the game, but it doesn't seem to work on all devices. Any ideas?

Re: How to cleanly exit game on Android

Posted: Sat Jan 23, 2016 7:21 pm
by bobbyjones
If stopping the music doesn't work then maybe that's the issue rather than how to cleanly exit. Unless love.focus isn't working on all devices. Which do you think it is?

Re: How to cleanly exit game on Android

Posted: Sat Jan 23, 2016 7:40 pm
by Kasperelo
bobbyjones wrote:If stopping the music doesn't work then maybe that's the issue rather than how to cleanly exit. Unless love.focus isn't working on all devices. Which do you think it is?
Stopping the music works, and my example works on most phones. But it doesn't work on my friends Huawei for some reason.

Re: How to cleanly exit game on Android

Posted: Sat Jan 23, 2016 9:33 pm
by bobbyjones
Oh so is it love.focus not working? If so maybe make an issue on the Löve issue tracker

Re: How to cleanly exit game on Android

Posted: Sat Jan 23, 2016 10:56 pm
by Kasperelo
Do I need to register a user if I want to post an issue?

Re: How to cleanly exit game on Android

Posted: Sun Jan 24, 2016 4:55 pm
by bobbyjones
Idk, it's bitbucket as a programmer you probably want an account on there anyways.