Android Question keycodes options

FJS

Active Member
Licensed User
Hello everyone!

I would like to know the how to detect the following cases:

1 - If the user presses back button
2- If the user presses home button and the app is not visible

I need to know this information, in order to management the music between activities. The idea is not stopping the music when you close one activity and open the next one, however, I would like to stop the music when the app is not visible.

Thank you very much for the support

Best regards
 

NJDude

Expert
Licensed User
To capture the BACK button search the forum, there are tons of samples, however, the HOME button cannot be captured.

To do what you want regarding playing music in the background, you will have to use a service.
 

FJS

Active Member
Licensed User
ok, thank you for your help

Could you give us an example with the service in order to manage the music?:)
 
Top