How to cleanly exit game on Android

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Kasperelo
Party member
Posts: 343
Joined: Fri Apr 13, 2012 1:47 pm
Location: The Milky Way

How to cleanly exit game on Android

Post 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?
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: How to cleanly exit game on Android

Post 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?
User avatar
Kasperelo
Party member
Posts: 343
Joined: Fri Apr 13, 2012 1:47 pm
Location: The Milky Way

Re: How to cleanly exit game on Android

Post 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.
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: How to cleanly exit game on Android

Post by bobbyjones »

Oh so is it love.focus not working? If so maybe make an issue on the Löve issue tracker
User avatar
Kasperelo
Party member
Posts: 343
Joined: Fri Apr 13, 2012 1:47 pm
Location: The Milky Way

Re: How to cleanly exit game on Android

Post by Kasperelo »

Do I need to register a user if I want to post an issue?
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: How to cleanly exit game on Android

Post by bobbyjones »

Idk, it's bitbucket as a programmer you probably want an account on there anyways.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 150 guests