Rejected for not using back button

This is not much a problem as its easy to fix but yesterday I submitted an app and it was rejected for not using the back button. I dont think its guaranteed to fail - depends on reviewer but its best to cover this.

You just need to make sure the back button steps out of any page to the previous page - even settings pages. If you are at the top level then quit.

To help everyone out, you can handle the back key on WP8 (and Android) like this…

local function onKeyEventReceived(event) -- Handle the back key on Android and WP8. if ((event.keyName == "back") and (event.phase == "down")) then local platformName = system.getInfo("platformName") if ((platformName == "Android") or (platformName == "WinPhone")) then -- Return true to prevent the back key from exiting your app. return true end end -- Return false to let the operating system do its default key handling. -- For the back key, this means it'll exit the app. return false end Runtime:addEventListener("key", onKeyEventReceived)

Note:  I tell everyone to use the “down” phase because there are some rogue Android devices such as the Galaxy Tab that won’t provide an “up” phase of the back key event if you hold down the back key for too long.  As far as I can tell, such an issue can never happen on WP8.

To help everyone out, you can handle the back key on WP8 (and Android) like this…

local function onKeyEventReceived(event) -- Handle the back key on Android and WP8. if ((event.keyName == "back") and (event.phase == "down")) then local platformName = system.getInfo("platformName") if ((platformName == "Android") or (platformName == "WinPhone")) then -- Return true to prevent the back key from exiting your app. return true end end -- Return false to let the operating system do its default key handling. -- For the back key, this means it'll exit the app. return false end Runtime:addEventListener("key", onKeyEventReceived)

Note:  I tell everyone to use the “down” phase because there are some rogue Android devices such as the Galaxy Tab that won’t provide an “up” phase of the back key event if you hold down the back key for too long.  As far as I can tell, such an issue can never happen on WP8.

Rob - is that all we need to add to not get rejected?

Hi Scott. Well so far, after quite a number of conversions, that is the only thing I have been rejected with. It’s pretty much the same as with Samsung so it’s good to put it in all android apps. So all round good experience with Windows phone submitting so far. A million miles from the depression inflicting goalpost moving process with Apple :slight_smile:

Let me further clarify, for Samsung I was able to get away with this code:

[lua]if samsungapp == true then
function onKeyEvent( event )

local phase = event.phase
local keyName = event.keyName

if( (keyName == “back”) and (phase == “down”) ) then
local function onComplete( event )
if “clicked” == event.action then
local i = event.index
if 1 == i then
native.cancelAlert( alert )
elseif 2 == i then
native.requestExit()
end
end
end
local alert = native.showAlert( “EXIT APP”, “ARE YOU SURE?”, { “NO”, “YES” }, onComplete )

return true
end

– for default behavior, return false.
return false
end
Runtime:addEventListener( “key”, onKeyEvent );
end [/lua]

Just wondering if I can do the same for Windows or if I need to make it work how they want. 

I have submitted 2 apps now and 1 got rejected due to the back button issue (I had no back button code implemented on either).

Scott

I think they want a proper back function. I had some menus like settings, help etc. They want back button to come out/exit those.

You can always try without but Im working this way with all my apps now that have menu screens for future compatibility (IE Fire TV/Google TV) etc. Personally its a nice function and I also heard Google rank apps that do this although that could be an old wives tale

Saying that, my first app didnt and it got through so its not 100% just worth doing anyway. Its not too hard.

Rob - is that all we need to add to not get rejected?

Hi Scott. Well so far, after quite a number of conversions, that is the only thing I have been rejected with. It’s pretty much the same as with Samsung so it’s good to put it in all android apps. So all round good experience with Windows phone submitting so far. A million miles from the depression inflicting goalpost moving process with Apple :slight_smile:

Let me further clarify, for Samsung I was able to get away with this code:

[lua]if samsungapp == true then
function onKeyEvent( event )

local phase = event.phase
local keyName = event.keyName

if( (keyName == “back”) and (phase == “down”) ) then
local function onComplete( event )
if “clicked” == event.action then
local i = event.index
if 1 == i then
native.cancelAlert( alert )
elseif 2 == i then
native.requestExit()
end
end
end
local alert = native.showAlert( “EXIT APP”, “ARE YOU SURE?”, { “NO”, “YES” }, onComplete )

return true
end

– for default behavior, return false.
return false
end
Runtime:addEventListener( “key”, onKeyEvent );
end [/lua]

Just wondering if I can do the same for Windows or if I need to make it work how they want. 

I have submitted 2 apps now and 1 got rejected due to the back button issue (I had no back button code implemented on either).

Scott

I think they want a proper back function. I had some menus like settings, help etc. They want back button to come out/exit those.

You can always try without but Im working this way with all my apps now that have menu screens for future compatibility (IE Fire TV/Google TV) etc. Personally its a nice function and I also heard Google rank apps that do this although that could be an old wives tale

Saying that, my first app didnt and it got through so its not 100% just worth doing anyway. Its not too hard.