Ingus Štāls7569555
Posts: 0
Joined: Wed Jun 03, 2015 9:05 pm

Backbutton Event affects all project

Hello, Support!

I do not know if this is issue or misunderstanding, but when I in Pages add Event listener to Backbutton with Action Naigate to page x, this has been added to the whole project and also affects first page and it is impossible to exit from the application. I faund one workaraund by Your advice, but it is not the best pratice. Would it be must logically before navigating to page, remove this listener?

Thanks,
Ingus

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Backbutton Event affects all project

Hello Ingus,

Please tell us exact steps to reproduce.
How do you add listener to Backbutton?

Ingus Štāls7569555
Posts: 0
Joined: Wed Jun 03, 2015 9:05 pm

Backbutton Event affects all project

I have two pages - home and form. In the editor I navigate to the form page, then in Events section I select form page and from Events I select Backbutton and in Action I choose - Navigate to page.

Also I have second Event attached to this form, which is Device Ready and there I execute Javascript, which opens inAppBrowser and keep reference to add handlers for loadstop and exit.

In home page I have one Listener to the button which navigates me on the form page

Then I compile .apk and install to a device. I click my created button which navigates me to from page and form page launch inAppBrowser , then I close inAppBrowser with phone backButton and I navigate back to home page. When I try to click against phone back button on my home page there seems no action, but I espect to exit application.

I resolve my problem using this workaraund

var pagePathName= window.location.pathname;
var page = pagePathName.substring(pagePathName.lastIndexOf("/") + 1);
if(page == "Home.html") {
navigator.app.exitApp();
} else {
Apperyio.navigateTo("Home", {});
}

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Backbutton Event affects all project

Hello Ingus,

As I can see you need custom logic. And you made it successfully, so use it if it works well.

Return to “Issues”