Problem with "n" button on Nook Color resulting in no sound when app is reopened.

I have a “key” listener for the Android version of our app, and that works as it should. I originally added a check to see if the device was a Nook and if so I would NOT add the key listener, but now have the listener for Nook as well.
As far as I am aware this should leave the “n” button to use it’s default functionality. Since we do not have a status bar displayed, this would mean exiting the app, which is what happens.
However if I use the “n” button to exit, when the app resumes there is no sound at all. I have to use the suspend and resume using the power button, and then the sound returns.

Here is the code I am using for my key event:

local AndroidKeyEvent = function( event )  
  
 local keyname = event.keyName  
  
 if (event.phase == "up" and (keyname=="back" or keyname=="menu")) then  
  
 if keyname == "menu" then  
  
 elseif keyname == "back" then  
  
 if storyboard.getCurrentSceneName() == "creditScreen" or storyboard.getCurrentSceneName() == "scoreScreen" or storyboard.getCurrentSceneName() == "settingsScreen" then  
  
 storyboard.purgeScene("levelSelect")  
 storyboard.gotoScene("levelSelect", "crossFade", 1000)  
 end  
 return true  
  
 elseif keyname == "search" then  
  
 end  
 end  
 end  
  
 if system.getInfo( "platformName" ) == "Android" then   
 Runtime:addEventListener( "key", AndroidKeyEvent )   
 end  

My systemEvent function is:

local function onSystemEvent( event )  
 if event.type == "applicationSuspend" or event.type == "applicationExit" then  
  
 if not isNook then  
 audio.pause()  
 end  
  
 elseif event.type == "applicationResume" or event.type == "applicationStart" then  
  
 audio.resume()  
  
 if event.type == "applicationResume" then  
  
 if \_G.isNook then  
 display.currentStage.alpha = 0.9  
  
 -- Force invalidate 1 second after resume  
 timer.performWithDelay( 1000, function()  
 display.currentStage.alpha = 1.0  
 end)  
 end   
 end   
 end  
 end  

As you can see there is an audio.pause() in suspend/exit and an audio.resume() in resume/start. However I have disabled the audio.pause() on Nook, while leaving the audio.resume() in all cases. Yet the bug persists.

Does anyone have any suggestions on what is going wrong?

Thanks [import]uid: 84115 topic_id: 32927 reply_id: 332927[/import]

Also, I have tried removing the audio.pause() entirely, in case my “isNook” bool was not working correctly (even though is does elsewhere). The problem still persists. [import]uid: 84115 topic_id: 32927 reply_id: 130794[/import]

Also, I have tried removing the audio.pause() entirely, in case my “isNook” bool was not working correctly (even though is does elsewhere). The problem still persists. [import]uid: 84115 topic_id: 32927 reply_id: 130794[/import]

Are you sure your app is being suspended when you press the “n” button?
I say this because the “n” button has 2 different behaviors depending if the status bar is shown or hidden.

If the status bar is visible, then the “n” button is treating like the “Home” key and will suspend your app.

If the status bar is hidden, then the “n” button is treated like the “Back” key and will exit your app. [import]uid: 32256 topic_id: 32927 reply_id: 130963[/import]

Are you sure your app is being suspended when you press the “n” button?
I say this because the “n” button has 2 different behaviors depending if the status bar is shown or hidden.

If the status bar is visible, then the “n” button is treating like the “Home” key and will suspend your app.

If the status bar is hidden, then the “n” button is treated like the “Back” key and will exit your app. [import]uid: 32256 topic_id: 32927 reply_id: 130963[/import]

I did mention in my first post that the app should (and does) exit when I press the N button “Since we do not have a status bar displayed, this would mean exiting the app, which is what happens.”

Since the app closes completely, it’s even more confusing that there is no sound when it starts up again.
We don’t have a “mute” setting which could be saved permanently between uses, the audio should always play (as it’s an audio game).

As you can see in the second code section, the audio.resume() is called regardless of whether it is the applicationResume or applicationStart phase anyway. This problem does not happen on any other Android devices, and I have only tested it on a Nook Color so there is a possibility that it does not happen on the new Nook HD’s. [import]uid: 84115 topic_id: 32927 reply_id: 131099[/import]

As of yesterday, we discovered that an audio bug was introduced in daily build #941 that would prevent audio from working the second time you run your app… and only on Android 2.2 devices such as the Nook Color. Sounds like exactly the issue that you’ve described. If you’ve been using daily build #941 or higher, then the newest daily build #970 resolves this issue. [import]uid: 32256 topic_id: 32927 reply_id: 131127[/import]

I did mention in my first post that the app should (and does) exit when I press the N button “Since we do not have a status bar displayed, this would mean exiting the app, which is what happens.”

Since the app closes completely, it’s even more confusing that there is no sound when it starts up again.
We don’t have a “mute” setting which could be saved permanently between uses, the audio should always play (as it’s an audio game).

As you can see in the second code section, the audio.resume() is called regardless of whether it is the applicationResume or applicationStart phase anyway. This problem does not happen on any other Android devices, and I have only tested it on a Nook Color so there is a possibility that it does not happen on the new Nook HD’s. [import]uid: 84115 topic_id: 32927 reply_id: 131099[/import]

As of yesterday, we discovered that an audio bug was introduced in daily build #941 that would prevent audio from working the second time you run your app… and only on Android 2.2 devices such as the Nook Color. Sounds like exactly the issue that you’ve described. If you’ve been using daily build #941 or higher, then the newest daily build #970 resolves this issue. [import]uid: 32256 topic_id: 32927 reply_id: 131127[/import]