Skip to main content
Inspiring
February 24, 2012
Question

background music continues to play when app exited

  • February 24, 2012
  • 8 replies
  • 1636 views

I just had a review of one of my apps from amazon on the kindle fire and the result came back saying:

Upon completion of our compatibility test processes, your app was found to be unresponsive when subjected to testing. To be compatible with Kindle Fire, the app’s core features must be responsive to user commands, and its primary functionality accessible and compliant with device specifications. Currently, the background music of the app continues to play even when the app has been exited.

to get my background music to loop I use this code

import flash.media.SoundMixer

var musicplayed:int = 0;

var MusicPlayer:Sound = new Music();

var songChannel:SoundChannel;

songChannel = MusicPlayer.play();

function loopMusic(event:Event)

{

  songChannel = MusicPlayer.play();

          songChannel.addEventListener(Event.SOUND_COMPLETE, loopMusic);

}

any idea whats wrong? It doesn't have this issue on iOS

This topic has been closed for replies.

8 replies

Colin Holgate
Inspiring
February 24, 2012

You have to listen for deactivate events, and pause you app and stop the sound playing. Then when there is an activate event you set the music playing again.

joeboy_ukAuthor
Inspiring
February 24, 2012

right,

like this

NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE , handleDeactivate, false, 0, true);

     function handleDeactivate(event:Event):void {

         //pause music here

       

     }

    NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, handleActivate, false, 0, true);

     function handleActivate(event:Event):void {

           //play music here

     }


February 24, 2012

Did that fix the problem for you Joe? I am going to have a similar problem on an upcoming app, it would be nice to resolve it now.