Zahhar Kirillov
Posts: 0
Joined: Thu Jul 25, 2013 9:41 am

Screen Backbutton event work for hardware Back button, but ignores Back button in the header

Is it a bug or feature?

I have a screen with 'mobileheader' element on it, that has checkbox 'Back Button' ticked. Using GUI builder, I added 'Backbutton' event with 'Run JavaScript' action. Javascript shows an alert('Back button pressed'); if event is fired.

Now I am testing it on my Android device and see, that pressing hardware back button fires an event and shown alertbox, but tapping on-screen button inside the caption just do simple history.back() with no 'Backbutton' event fired.

To my mind, this is a bug, as default 'Back button' in the screen header should fire http://docs.phonegap.com/en/3.0.0rc1/... event as well.

Workaround is to make my own Back-button-component with desired functionality and add it to headers on the screens requiring this behaviour; or to make a screen templete with custom button. But why not to have this functionality out of the box?

Thank you.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Screen Backbutton event work for hardware Back button, but ignores Back button in the header

It's how jQuery Mobile works. The button that you added in the header is a standard jQuery Mobile back button (it does history.back(-1)). jQuery Mobile doesn't know anything about the Android hardware button.

Zahhar Kirillov
Posts: 0
Joined: Thu Jul 25, 2013 9:41 am

Screen Backbutton event work for hardware Back button, but ignores Back button in the header

Max, I agree with your explanation. Thank you for quick reply.

For me as a developer, Appery platform is a valuable tool bacouse it allows me to overcome some limitations of particular hw platforms or other developer's tools in no time. Don't you think it might be logical to have an unified behaviour between 'Backbutton' event and default Back button?

From the developer's point of view, when I want 'Backbutton' event to be fired, it means event should be fired every time user goes back, either using hw button or on-screen button, should not it?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Screen Backbutton event work for hardware Back button, but ignores Back button in the header

You welcome.

The issue is that, it has to be the same code base whether the app is running a mobile web or as hybrid (Android, iOS).

Return to “Issues”