"n" button for Nook

Hi,
I recently submitted my app for the Nook. Got a reply back

Files: Rejected: The application does not handle “n” key interruption on Nook Color.

Would someone be able to point me in the right direction? I’m sure there is a simple solution, but I haven’t found it on the forums.

Thanks in advance. [import]uid: 90878 topic_id: 21970 reply_id: 321970[/import]

first off - when you built, did you build for NOOK color.
second - make sure to include what build of corona you’re using [import]uid: 32462 topic_id: 21970 reply_id: 87371[/import]

Thanks for the reply.

Yes, I did build for Nook.
Using daily build .715 (latest stability I’ve found for my project)

Is it possible it has something to do with the resume app functionality? [import]uid: 90878 topic_id: 21970 reply_id: 87408[/import]

The “n” key on Nook is really the Android “home” key. Corona does not support the “home” key. That said, pressing the home key makes your app suspend itself, which is a system event that your app can receive and should handle to save the current state of your app. You will want to handle the “applicationSuspended” and “applicationExit” events. Please see the link below for more details.
http://developer.anscamobile.com/content/events-and-listeners#Xsystem

Once you’ve done the above, Barnes & Nobles should accept your app. Other Corona apps have passed their app review process just fine without overriding the “n” key. [import]uid: 32256 topic_id: 21970 reply_id: 88178[/import]

Thanks. I think I got it. Would anyone be able/willing to test out the app on their Nook color or tablet? Shouldn’t take long to test at all. It’s a fairly simple app. [import]uid: 90878 topic_id: 21970 reply_id: 88454[/import]

I just got a Nook and could help you out. [import]uid: 79834 topic_id: 21970 reply_id: 88844[/import]

That’d be so awesome if you could just take a quick look at it. Just play with it to make sure everything is working ok on the nook.

Here’s the link to the api file.
www.selectedfocus.com/nook/Adopt%20A%20Club.apk

you can email me at gregory[@]selectedfocus.com

Thanks so much. [import]uid: 90878 topic_id: 21970 reply_id: 88952[/import]

Hey, I’ll try it out in few hours and get back to you. Do you happen to have an android phone you could test my app out on? [import]uid: 79834 topic_id: 21970 reply_id: 88975[/import]

I have applicationSuspended and applicationExit events but my app still exists when the N button is pressed. Does anyone have a real working solution to this? [import]uid: 42903 topic_id: 21970 reply_id: 115270[/import]

The Nook’s “n” key acts like a “Back” key for apps… and a “Home” key everywhere else. That’s just how B&N made it. So, this means that the app is behaving correctly. A “Back” key will exit the app by default, just like how it works on every other Android device. You should be getting an applicationExit event when the “n” key is pressed.

Now, you can override the “Back” key if you want and it makes sense for your app. Some people will do that to go back to a menu or homescreen interface within their app. Or to display an “Are you sure” type of message. Please see the following API documentation on how to receive/override key events…
http://docs.coronalabs.com/api/event/key/keyName.html

Also have a look at sample app “Hardware/KeyEvents” for an example on how to listen for key events and override them. That particular example will override the Back key and prevent the app from exiting. Notice how on Nook the “n” key registers as a “Back” key. There is your proof on how the Nook handles that button. [import]uid: 32256 topic_id: 21970 reply_id: 115433[/import]

Is there anyway then to override the “back” key (meaning the n key on nook) to have it suspend the app just as if you were hitting the “home” key on regular Android devices.

I am having some trouble getting my app approved by B&N because they want the app to resume where it left off, and since the “back” button is calling applicationExit that is not happening. Application Suspend / Resume is working just fine across my app for both iOS and regular Android devices.

I originally had the n key going to the previous screen since it’s the “back” button (as it should on regular android devices) but B&N didn’t seem to like that either.

Any suggestions? [import]uid: 5786 topic_id: 21970 reply_id: 125696[/import]

The simplest solution to have the “n” button suspend your app is to set up your app to show the status bar on startup as follows.
[lua]display.setStatusBar(display.DefaultStatusBar)[/lua]

You see, the “n” button has different behaviors depending if the status bar is shown or not. When there is not status bar (ie: fullscreen mode), the “n” button behaves like the “Back” key and will exit your app by default. If the status bar is shown, then the “n” button behaves like a “Home” key and will suspend your app… which is the behavior that you want. [import]uid: 32256 topic_id: 21970 reply_id: 125765[/import]

Thanks for the quick response Josh.

This is definitely an acceptable solution as the status bar is pretty small and won’t disrupt any of my game content anyways.

I would then assume with this status bar I have access to the “back” button in the status bar through the Android “back” key event? If so this is a great solution.

I just wonder though why if B&N specifically makes the “n” button into the “back” key in fullscreen apps why then would they reject an app for using the default behavior for that key? Doesn’t seem to make much sense to me.

[import]uid: 5786 topic_id: 21970 reply_id: 125773[/import]

Happy to help! Hopefully the solution I posted will help others too.

Yes, the status bar at the bottom does provide a “Back” key which you can override and block if you wanted to.
As to why B&N made it this way… I don’t know. It’s just the way it is. :slight_smile:

Good luck with your app! [import]uid: 32256 topic_id: 21970 reply_id: 125781[/import]

One more thing. If you want to support Nook HD/HD+, then you should wait for our next daily build, which will be coming soon. [import]uid: 32256 topic_id: 21970 reply_id: 125782[/import]

Thanks again Josh! This is working great now and I actually would prefer showing the status bar on nook now that I see it has the back and menu buttons built into it, didn’t realize this previously.

And yea I’ve been following the threads and blog post about the HD/HD+ as my app already on Nook got the “DRM” rejected emailed as many have. Glad you see you guys are already on top of it! [import]uid: 5786 topic_id: 21970 reply_id: 125785[/import]

Is there anyway then to override the “back” key (meaning the n key on nook) to have it suspend the app just as if you were hitting the “home” key on regular Android devices.

I am having some trouble getting my app approved by B&N because they want the app to resume where it left off, and since the “back” button is calling applicationExit that is not happening. Application Suspend / Resume is working just fine across my app for both iOS and regular Android devices.

I originally had the n key going to the previous screen since it’s the “back” button (as it should on regular android devices) but B&N didn’t seem to like that either.

Any suggestions? [import]uid: 5786 topic_id: 21970 reply_id: 125696[/import]

The simplest solution to have the “n” button suspend your app is to set up your app to show the status bar on startup as follows.
[lua]display.setStatusBar(display.DefaultStatusBar)[/lua]

You see, the “n” button has different behaviors depending if the status bar is shown or not. When there is not status bar (ie: fullscreen mode), the “n” button behaves like the “Back” key and will exit your app by default. If the status bar is shown, then the “n” button behaves like a “Home” key and will suspend your app… which is the behavior that you want. [import]uid: 32256 topic_id: 21970 reply_id: 125765[/import]

Thanks for the quick response Josh.

This is definitely an acceptable solution as the status bar is pretty small and won’t disrupt any of my game content anyways.

I would then assume with this status bar I have access to the “back” button in the status bar through the Android “back” key event? If so this is a great solution.

I just wonder though why if B&N specifically makes the “n” button into the “back” key in fullscreen apps why then would they reject an app for using the default behavior for that key? Doesn’t seem to make much sense to me.

[import]uid: 5786 topic_id: 21970 reply_id: 125773[/import]

Happy to help! Hopefully the solution I posted will help others too.

Yes, the status bar at the bottom does provide a “Back” key which you can override and block if you wanted to.
As to why B&N made it this way… I don’t know. It’s just the way it is. :slight_smile:

Good luck with your app! [import]uid: 32256 topic_id: 21970 reply_id: 125781[/import]