Back Button Error

Hello,

We’ve been publishing apps through Amazon for some time, but since we’ve tried pushing builds to live we’ve had apps kicked back for the following reason:

"App displays Runtime error after tapping on device back button "

In the projects we are trying to publish, there is no code (that we have) to take over the back button at all.  We’ve tried taking over the button to make the app exit with native.requestExit(); and we’ve also tried making the back button do nothing at all, but each time they’ve rejected the app saying that using the back button causes an error.  We’re also using build 3012, since we’re using the new admob plugin and splash screen control.

We reverted to build 2906 and are using the old(er) admob plugin, the one that uses the line:
 

[“plugin.google.play.services”] = { publisherId = “com.coronalabs”},

in build.settings.  Submitting that, the apps have been getting passed on Amazon.  However, they still encounter an error when we try to use the premium admob plugin on our Amazon builds and end up rejecting it.  We have also released builds on iTunes and Google Play where the ads were working just fine under the new premium plugin, and again, we don’t even make use of the back button in our projects so the fact that it’s causing an error in those newer builds is odd.  Unfortunately, they aren’t giving us the logs so it’s hard to help pinpoint where the issue is.

We tried recently with daily build 3026, but again, they’re rejecting the app for the same issue with the back button functionality causing errors, which is still something we’ve never even had to handle before when working with the older versions of Corona.  And as mentioned before, we don’t even have any back button handling in our projects.  While there are no issues when building with 2906 and rolling back to the old(er) version of Admob, as mentioned before, we do want to use the premium Admob plugin for our ad service… especially since we are paying for it.

Okay, now that I have my own Amazon device here’s what seems to be going on.

It’s giving me an error that it can’t find ‘plugin.admob,’ when I have it specified in build settings the same way as on iOS and Google Play (and it does work on those two platforms).  

[“plugin.admob”] = { publisherId = “com.coronalabs”, supportedPlatforms = { iphone=true, android=true } },

Have it just like that in the plugins table, which is the same as it is written in the documentation minus white space.  So I’m wondering what can be done to resolve this.  Again, this is for Corona version 3026 and using the admob plugin we paid for on the marketplace.

Hiiiiiii
I found the answer by using the my ideas . I had to put that code before the onCreate the errors I’ve been having was putting that code after the onCreate this  function are you  use  …

@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
if (keyCode == KeyEvent.KEYCODE_BACK)
{
//do smth
}
return super.onKeyDown(keyCode, event);
}

I’ve asked Engineering to look into this.

Rob

@elsoqo

For Amazon builds you need to add [“android-kindle”]=true to supportedPlatforms.

@elsoqo

On second thought, it’s better if you remove supportedPlatforms from your plugin entry.

We’re in the process of updating our documentation to remove supportedPlatforms from the project settings. It’s only needed for certain edge-cases where you specifically want to exclude certain device platforms.

@elsoqo

try this module I have. If you are using composer this might help

http://mobitutz.com/2017/03/08/handling-android-back-key/
 

We reverted to build 2906 and are using the old(er) admob plugin, the one that uses the line:
 

[“plugin.google.play.services”] = { publisherId = “com.coronalabs”},

in build.settings.  Submitting that, the apps have been getting passed on Amazon.  However, they still encounter an error when we try to use the premium admob plugin on our Amazon builds and end up rejecting it.  We have also released builds on iTunes and Google Play where the ads were working just fine under the new premium plugin, and again, we don’t even make use of the back button in our projects so the fact that it’s causing an error in those newer builds is odd.  Unfortunately, they aren’t giving us the logs so it’s hard to help pinpoint where the issue is.

We tried recently with daily build 3026, but again, they’re rejecting the app for the same issue with the back button functionality causing errors, which is still something we’ve never even had to handle before when working with the older versions of Corona.  And as mentioned before, we don’t even have any back button handling in our projects.  While there are no issues when building with 2906 and rolling back to the old(er) version of Admob, as mentioned before, we do want to use the premium Admob plugin for our ad service… especially since we are paying for it.

Okay, now that I have my own Amazon device here’s what seems to be going on.

It’s giving me an error that it can’t find ‘plugin.admob,’ when I have it specified in build settings the same way as on iOS and Google Play (and it does work on those two platforms).  

[“plugin.admob”] = { publisherId = “com.coronalabs”, supportedPlatforms = { iphone=true, android=true } },

Have it just like that in the plugins table, which is the same as it is written in the documentation minus white space.  So I’m wondering what can be done to resolve this.  Again, this is for Corona version 3026 and using the admob plugin we paid for on the marketplace.

Hiiiiiii
I found the answer by using the my ideas . I had to put that code before the onCreate the errors I’ve been having was putting that code after the onCreate this  function are you  use  …

@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
if (keyCode == KeyEvent.KEYCODE_BACK)
{
//do smth
}
return super.onKeyDown(keyCode, event);
}

I’ve asked Engineering to look into this.

Rob

@elsoqo

For Amazon builds you need to add [“android-kindle”]=true to supportedPlatforms.

@elsoqo

On second thought, it’s better if you remove supportedPlatforms from your plugin entry.

We’re in the process of updating our documentation to remove supportedPlatforms from the project settings. It’s only needed for certain edge-cases where you specifically want to exclude certain device platforms.

@elsoqo

try this module I have. If you are using composer this might help

http://mobitutz.com/2017/03/08/handling-android-back-key/