0 Replies Latest reply on Mar 16, 2015 7:31 PM by JRHall

    Android home button does not suspend my app

    JRHall

      Hi,

       

      I have an app built in Edge Animate and then packaged in Phonegap Build.

       

      The app works fine and does what it should. However on Android, when I press the home button, the app does not suspend - or at least the audio does not.

       

      Is there a technique to use the event of pressing the home button on the device to pause or mute the audio?

       

      I have tried

           document.addEventListener("pause", onPause, false);

      in compositionReady and creationComplete as well as in my html, and with it

           function onPause() {

              my_MUSIC.pause();

           }

       

      I am using Cordova's media plugin to control the audio as EA's native system does not seem to work with Android builds. So my audio loop command looks like this:

           function loopMUSIC(url) {

                // Play the audio file at url

                my_MUSIC = new Media(url,

                // success callback

                function () {},

                // error callback

                function (err) {},

                //Loop audio

                function (status){

                     if (status === Media.MEDIA_STOPPED){

                          my_MUSIC.play();

                     }

                });

                my_MUSIC.play();

           }


      Any ideas gratefully received, thanks