This is a migrated thread and some comments may be shown as answers.

Any known issues with backbutton event with Cordova 3.0 project

13 Answers 146 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jan-Dirk
Top achievements
Rank 1
Jan-Dirk asked on 15 Oct 2013, 11:09 AM
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.

13 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 18 Oct 2013, 09:28 AM
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.
0
Marco
Top achievements
Rank 1
answered on 21 Oct 2013, 03:06 PM
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?
0
Steve
Telerik team
answered on 21 Oct 2013, 03:52 PM
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.
0
Marco
Top achievements
Rank 1
answered on 22 Oct 2013, 07:33 AM
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.
0
Steve
Telerik team
answered on 23 Oct 2013, 12:52 PM
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.
0
Jan-Dirk
Top achievements
Rank 1
answered on 23 Oct 2013, 01:05 PM
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
0
Eugen
Top achievements
Rank 1
answered on 23 Oct 2013, 01:06 PM
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
0
Steve
Telerik team
answered on 23 Oct 2013, 01:18 PM
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.
0
Jan-Dirk
Top achievements
Rank 1
answered on 23 Oct 2013, 01:22 PM
@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.
0
Marco
Top achievements
Rank 1
answered on 23 Oct 2013, 01:29 PM
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.   
0
Eugen
Top achievements
Rank 1
answered on 23 Oct 2013, 02:27 PM
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.
0
Steve
Telerik team
answered on 23 Oct 2013, 02:48 PM
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.
0
Jan-Dirk
Top achievements
Rank 1
answered on 24 Oct 2013, 11:39 AM
Steve,

That seems to work! Thanks for your help!
Tags
General Discussion
Asked by
Jan-Dirk
Top achievements
Rank 1
Answers by
Steve
Telerik team
Marco
Top achievements
Rank 1
Jan-Dirk
Top achievements
Rank 1
Eugen
Top achievements
Rank 1
Share this question
or