Android Question keycodes options

Discussion in 'Android Questions' started by FJS, Jun 20, 2015.

  1. FJS

    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
     
  2. NJDude

    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.
     
    thedesolatesoul and RandomCoder like this.
  3. FJS

    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?:)
     
  4. NJDude

    NJDude Expert Licensed User

    Just move your playback code to a SERVICE
     
    thedesolatesoul and RandomCoder like this.
Loading...