Any known issues with backbutton event with Cordova 3.0 project

14 posts, 0 answers
  1. Jan-Dirk
    Jan-Dirk avatar
    327 posts
    Member since:
    Jun 2012

    Posted 15 Oct 2013 Link to this post

    Is anyone aware of an issue where the backbutton event is not firing with projects under Cordova 3.0.

    I have an app where this button works well with Cordova 2.7 and older, but not with 3.0. I couldn't find any such issues while googling for it.
  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 18 Oct 2013 Link to this post

    Hello JD,

    It seems that there was such a problem (see their google group discussion), but according to the issue here, it is resolved in 3.0.0 i.e. it was broken in between 2.9 and 3.0.0. I've just tested the backbutton on a Cordova 3.0 project in Icenium and it works on my end. Here is the simple javascript used:

    document.addEventListener("deviceready", onDeviceReady, false);
     
    function onDeviceReady() {
        navigator.splashscreen.hide();
        document.addEventListener("backbutton", onBackButton, false);
    }
     
    function onBackButton() {
        alert("Back Button fired");
    }


    Regards,
    Steve
    Telerik
    You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  3. Marco
    Marco avatar
    3 posts
    Member since:
    Feb 2012

    Posted 21 Oct 2013 Link to this post

    Dear Steve,
    I have the same problem in my application with cordova 3.0.0, kendo mobile and Icenium Graphite.
    The backbutton event on my android phone ( 4.0.4 ) is not fired...

    I have tried the code in the previous post, but nothing changed.

    Can you help me please?
  4. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 21 Oct 2013 Link to this post

    Hi Marco,

    We can't reproduce the backbutton problem locally and the code I provided works locally on Android 4.0.3 and 4.0.4 devices, so it is not an Android version issue. Please prepare a sample where the issue is isolated and we can use this sample to investigate what is going on (we would need your project name).

    Regards,
    Steve
    Telerik
    You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  5. Marco
    Marco avatar
    3 posts
    Member since:
    Feb 2012

    Posted 22 Oct 2013 Link to this post

    Dear Steve.
    at this link https://dl.dropboxusercontent.com/u/188387528/Termotab-kendoCloned.zip
    you can download an extract from my project ( exported from icenium ) with just two pages.
    I want to catch the physical backbutton on the android phone in order to execute the same function of the kendo backbutton.
  6. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 23 Oct 2013 Link to this post

    Hi Marco,

    Unfortunately the exported project you've sent works as expected on our end. I've copied my test project to your account under the name 'blank'. Can you deploy it on your device as it is without any changes and let us know whether it works?

    If not, what is your exact Android device model and have you tried another Android device?

    Regards,
    Steve
    Telerik
    You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  7. Jan-Dirk
    Jan-Dirk avatar
    327 posts
    Member since:
    Jun 2012

    Posted 23 Oct 2013 Link to this post

    As topic starter it is time to jump in. Your sample works as expected on my phone. However the project I am having troubles with (see my project that starts with E) doesn't.

    With Cordova 2.7.0 the backbutton works as expected, but not with Cordova 3.0. Testers reported the same.

    I am experiencing this on a Samsung Galaxy S2 with Android 4.1.2
  8. Eugen
    Eugen avatar
    4 posts
    Member since:
    Sep 2013

    Posted 23 Oct 2013 Link to this post

    Hi everyone,

    I can only confirm Marco's issue. I can not get the backbutton event to fire on any of my cordova projects with Icenium Graphite.

    At first I thought the issue had to do with kendoui mobile, but even using a blank project the backbutton event is never triggered.

    EDIT: Actually scratch that. It DOES work just fine in a blank project just not with mine. I've search throughout the whole project and I definitely DO NOT override it any other point. I'm a little clueless here but it is not Icenium OR KendoUI causing the problem.



    Regards,
    Eugen
  9. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 23 Oct 2013 Link to this post

    Hi guys,

    Thank you all for the feedback. Clearly the issue is not trivial and surfaces under certain conditions. I would appreciate if you isolate this in sample projects, so we can quickly get to the bottom of it. Our local attempts to reproduce any problem with it have been unsuccessful so far.
    @JD: Which one of your projects exhibits the issue? Can you isolate it in a simple sample?

    Regards,
    Steve
    Telerik
    You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  10. Jan-Dirk
    Jan-Dirk avatar
    327 posts
    Member since:
    Jun 2012

    Posted 23 Oct 2013 Link to this post

    @Steve: I experience the issue in the E85 prices project. Not sure if I can isolate it on short notice, so give it a go with the project if you want.
  11. Marco
    Marco avatar
    3 posts
    Member since:
    Feb 2012

    Posted 23 Oct 2013 Link to this post

    I have restarted my project  (with a different name ) from the beginning starting from a new blank cordova example 
    Now the backbutton works for the new project.

    I'll let you know if it will stop working again.   
  12. Eugen
    Eugen avatar
    4 posts
    Member since:
    Sep 2013

    Posted 23 Oct 2013 Link to this post

    I basically did the same.
    I created a completely new KendoUI-Mobile project and used my sources from the other project.

    Now it works like a charm. This seems to be the only solution that actually works.
  13. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 23 Oct 2013 Link to this post

    Hi guys,

    Mistery solved! The problem is indeed caused by the omission of Cordova's App plugin, which I mentioned and given links to in the very first reply in this thread.

    The difference between those projects that work and those that do not is the presence of custom Android config.xml file in your projects. Anyone who has done Edit Configuration -> Android config.xml in their project even without changing anything in the file, would end up with the Cordova App plugin missing. This plugin however is required for the Android button mappings. So in order to have a modified config.xml and working Cordova Android events, you should add the following to your Android config.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <cordova>
    .....
        <feature name="App">
             <param name="android-package" value="org.apache.cordova.App" />
             </feature>
    .......
    </cordova>

    For those of you who export their projects and import them to new blank projects - most likely you have not included the App_Resources folder where the Android config.xml is stored and that is why it works.

    We would address this problem in the upcoming Icenium version, so that it does not occur for new Cordova 3.0 projects, but still users who migrate to Cordova 3.0 from older versions, would have to do this manually.

    Sorry for the inconvenience guys!

    Regards,
    Steve
    Telerik
    You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  14. Jan-Dirk
    Jan-Dirk avatar
    327 posts
    Member since:
    Jun 2012

    Posted 24 Oct 2013 Link to this post

    Steve,

    That seems to work! Thanks for your help!
Back to Top