nook color app rejected - back button

Nook Color App was rejected on the nook color HD & HD+ for the following:

On the NOOK HD and NOOK HD+, the Back button in the System bar at the bottom of the screen should take users to the previous screen in the app. If users are already at the home screen, the Back button should quit the app.

For the Nook color the status bar is set to display (which is where the 'soft back button is located).

I used the following code:

// Set up a listener for the NOOK button
local function onNookPress( event )
local phase = event.phase
local keyName = event.keyName
if keyName == “back” then

– Do stuff

– Keep the return true line here because
– you want to successfully return
return true
end
end
– Attach the listener to the Runtime object
Runtime:addEventListener( “key”, onNookPress)

Works fine on my Nook Color.
Does the Nook Color HD & HD+ require different coding ?

Thanks,
Frank

[import]uid: 31039 topic_id: 34520 reply_id: 334520[/import]

Let me get some advice on this. As far as I know programming a standard Android Back button should work.

[import]uid: 199310 topic_id: 34520 reply_id: 137265[/import]

I just submitted to Nook yesterday. I couln’t get the Android back button to function like I wanted so I have a native.alert appear when it’s pressed stating “button disabled”, “Sorry for the inconveniece”. This leaves the button functional, but it isn’t used how it’s intended. Think that will be an issue? [import]uid: 46082 topic_id: 34520 reply_id: 137372[/import]

@sXc

This is what Nook emailed me;

Its not acceptable for your application to ignore the Back button on the Nook Color, however if you’d like you can have it take the user to the main/1st page and then quit the application on a 2nd press that would be acceptable. If you choose to do so, please reference this ticket in the Credentials field so that the QA team does not fail your app for that reason.

[import]uid: 31039 topic_id: 34520 reply_id: 137383[/import]

@Rob,

Any progress on this ?

Thanks,
Fran [import]uid: 31039 topic_id: 34520 reply_id: 137432[/import]

@Rob,

Any progress on this ?

Thanks,
Frank [import]uid: 31039 topic_id: 34520 reply_id: 137433[/import]

Soon after posting my question I got almost the exact same message you got. They told me I’m not using the back button or the “N” button how they are intended to be used. It’s not difficult to fix, but it is going to take a little time. The “N” button is essentially the Android “Home” button. You should only have to save your apps data when its event is suspended, closed, or exited. [import]uid: 46082 topic_id: 34520 reply_id: 137447[/import]

Not yet @frankxyz. [import]uid: 199310 topic_id: 34520 reply_id: 137449[/import]

Let me get some advice on this. As far as I know programming a standard Android Back button should work.

[import]uid: 199310 topic_id: 34520 reply_id: 137265[/import]

@Rob: any progress?

I had the same note today on one of our apps - any help on this is appreciated as I need to get it in this week.

Thanks [import]uid: 63661 topic_id: 34520 reply_id: 137790[/import]

Nothing yet. It’s only been a couple of business days since I brought it up. I’ll check back and see if there is any update. [import]uid: 199310 topic_id: 34520 reply_id: 137792[/import]

Just curious, if you’re in the main menu, and you want the “n” button to close the application, what command would you use?

for example, in all the other scenes, we used:

storyboard.gotoScene(“mainScreen”, “fade”);

etc.

What would you use to close the app? [import]uid: 63661 topic_id: 34520 reply_id: 137795[/import]

native.requestExit()

http://docs.coronalabs.com/api/library/native/requestExit.html

Keep in mind that for iOS, Apple doesn’t want you exiting apps since it looks like a crash and those users don’t expect it. Android is different, back and home need to exit gracefully.
[import]uid: 199310 topic_id: 34520 reply_id: 137798[/import]

Just a random thought on this… Okay, not so random, I did a test… When I press the N button on my Nook Color, two events fire:

D/WindowManager( 958): interceptKeyTi code=4 down=true repeatCount=0 keyguardOn=false mHomePressed=false  
I/Corona ( 1378): table: 0x2bf138 {  
I/Corona ( 1378): [phase] =\> "down"  
I/Corona ( 1378): [name] =\> "key"  
I/Corona ( 1378): [keyName] =\> "back"  
I/Corona ( 1378): }  
D/WindowManager( 958): interceptKeyTi code=4 down=false repeatCount=0 keyguardOn=false mHomePressed=false  
I/Corona ( 1378): table: 0x2bf560 {  
I/Corona ( 1378): [phase] =\> "up"  
I/Corona ( 1378): [name] =\> "key"  
I/Corona ( 1378): [keyName] =\> "back"  
I/Corona ( 1378): }  

Much like a touch handler where you have a began phase and an ended phase, your event handler fires twice. Your code:

// Set up a listener for the NOOK button  
local function onNookPress( event )  
 local phase = event.phase  
 local keyName = event.keyName  
 if keyName == "back" then  
 -- Do stuff  
 -- Keep the return true line here because  
 -- you want to successfully return  
 return true  
 end  
end  
-- Attach the listener to the Runtime object  
Runtime:addEventListener( "key", onNookPress)  

Your event handler is going to run twice, so whatever you’re doing inside that if is going to happen twice. Also, the “return true” probably should be outside the if statement. I would do something more like:

[code]
local function keyListener(event)
utility.print_r(event)
if event.phase == “up” and event.keyName == “back” then
–do stuff like:
–if storyboard.storyboard.getCurrentSceneName() == “menu” then
– native.requestExit()
–else
– storyboard.gotoScene(storyboard.getPrevious())
–end
end
return true
end

Runtime:addEventListener( “key”, keyListener )
[/code] [import]uid: 199310 topic_id: 34520 reply_id: 137804[/import]

Everyone,

The ‘n’ button on the Nook can either be a “back” key or a “home” key, depending on the state of the status bar. This is by B&N’s design.

If your app displays a status bar, then the ‘n’ button is treated like a “home” key and will suspend your app. You cannot override the “home” key.

If your app is *not* displaying a status bar (ie: it is set to [lua]display.HiddenStatusBar[/lua]), then the ‘n’ button is treated like a “back” key and will exit your app unless your override it as Rob has shown up above.
[import]uid: 32256 topic_id: 34520 reply_id: 137806[/import]

@Rob
I did include your version on my last submission , but it was rejected for the reason I mentioned above.

When I invoke the ‘reverse arrow’ in the Nook Color menu, it acts correctly.
The rejection seems to imply that there is a problem on the HD & HD+ which Is why I posed the question.

As I do not have a Nook HD, it seems there may be a difference in coding the HD & HD+ from the Nook Color with regards to the ‘soft button’ used in their menu.

[import]uid: 31039 topic_id: 34520 reply_id: 137811[/import]

—wrong thread [import]uid: 46082 topic_id: 34520 reply_id: 137810[/import]

Frank,

The onscreen “back” button works the same between the old Nooks and the new Nook HDs. I’ve confirmed this.

The one thing I would do differently is override the “down” phase instead of the “up” phase… but that is to work-around an issue on Galaxy Tabs where they refuse to give you the “up” phase if you hold the back key for too long.
[import]uid: 32256 topic_id: 34520 reply_id: 137815[/import]

Joshua,
I’ll code it your way and ask b&n for a more accurate reason, should they reject it again.

I’ll get back. [import]uid: 31039 topic_id: 34520 reply_id: 137816[/import]

So what is the final verdict then? I’m testing some of these, and still having trouble.

Which is the best way to code this so if you’re in any other scene, it goes back to the menu, and if you’re in the menu, it closes the app?

Thank you! [import]uid: 63661 topic_id: 34520 reply_id: 137824[/import]