Page 1 of 1

Program the back button on mobile phone?

Posted: Wed Nov 14, 2012 1:36 pm
by Stavros

How can I prevent the application from going back to the previous screen when the user pushes the "back" button on his/her Android device?
How can I direct him/her to the startscreen?

Thank you


Program the back button on mobile phone?

Posted: Wed Nov 14, 2012 1:41 pm
by Maryna Brodina

Hello! You should add JS handler to navigate to Startscreen when Backbutton is pressed. This should help http://docs.phonegap.com/en/2.2.0/cor... (see backbutton event)


Program the back button on mobile phone?

Posted: Wed Nov 14, 2012 2:00 pm
by Stavros

Thank you Marina,

Because I am a novice Tiggzi user,...
Where should I put the script

document.addEventListener("backbutton", onBackKeyDown, false);

function onBackKeyDown() {
// Handle the back button
???
}

Startscreen lets say is my target page,

Thanks again


Program the back button on mobile phone?

Posted: Wed Nov 14, 2012 3:21 pm
by Maryna Brodina

Try to create Custom JS and enter the next code

document.addEventListener("backbutton", onBackKeyDown, false);

function onBackKeyDown() {
Tiggzi.navigateTo('Startscreen');
}


Program the back button on mobile phone?

Posted: Sat Nov 17, 2012 4:50 am
by Stavros

Thank you very much!
(sorry for the delayed answer)