Emmz
Posts: 0
Joined: Sat Jun 23, 2012 11:06 pm

back button Android

How Do I use the Event "Back" on Android Phone.
I have many screens and when the user presses the android back button I want to ignore(stop) the app from exiting when on the Menu screen.
I tried the navigate to screen menu on event back. But no-go.

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

back button Android

Emmz
Posts: 0
Joined: Sat Jun 23, 2012 11:06 pm

back button Android

Yes seen that. But Tiggzi has Properties Events Tab.
Select Back. Run Custom JS Tiggr.navigateTo('Screen you want to goto'); Or using the Navigate to Page. But No Go.
Or simple test
Event--- Back
Run js eg alert('Back button Pressed');
The alert not show

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

back button Android

Hello! As I understand you have project with many screens and everything works except this button? Could you please share your project (if it's not shared yet) and tell us on what device with what Android version do you test?

Emmz
Posts: 0
Joined: Sat Jun 23, 2012 11:06 pm

back button Android

Ok. Sent u an email with info..
Samsung Galaxy s II Android 2.3.5

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

back button Android

Hello!

First of all you use Tiggr.navigateTo('SCREEN_NAME') function from own script- it's full page navigation. You should use ajax navigation Tiggr.navigateTo('SCREEN_NAME',{}). Second issue – you have JS for checking registration on Load event. It should be on Page Show event. Try to make changes and let us know if you still have any problem.

Ralph
Posts: 0
Joined: Mon Aug 13, 2012 4:16 pm

back button Android

FWIW,

I had the same problem.

I turns out my situation was caused by my page navigation choices. I had checked the "Use full screen refresh" box on the "Navigate to page" screen (not sure why!??).

Image

Once I removed the check from that box, everything worked just swell.

Ralph

Emmz
Posts: 0
Joined: Sat Jun 23, 2012 11:06 pm

back button Android

Yes I corrected The screen nav and used page show instead.
No Change thou...
Not sure you understood my question though.
Its The ANDROID phones back button event I'm trying to capture. Not the back button in the Header.
The events drop down list has "Backbutton". But it never gets fired when androids back button pressed.
However the Menu event works... But the Search button does not either.
I used a work around for the Back button.
On the DeviceReady I put
codedocument.addEventListener("backbutton", mybackHandler, false);
And added custom JS
// From this on Device Ready document.addEventListener("backbutton", mybackHandler, false);
function mybackHandler() {
if ($.mobile.activePage.attr('dsid') == 'Menu'){
alert ("Dont Use The Back Button! Click The Exit button to Exit..");
}
//navigator.app.backHistory();
history.back();

}
/code

Emmz
Posts: 0
Joined: Sat Jun 23, 2012 11:06 pm

back button Android

Thanks for the tip. But not using that function.
Tiggr.navigateTo('SCREEN_NAME',{}) Is Used.
Supposed to be axaj load

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

back button Android

Hello! Do you work on lbComm1 App?

If yes, you binded handler for "backbutton" on the first screen. But you go out from this screen with non-ajax call function naviagateTo('screen_name'). Because of this your first screen is removed from DOM and handler for "backbutton" is removed too. In order to prevent this behavour you should to use ajax call function naviagateTo('screen_name',{}), or if you don't want to use ajax navigation you should to bind hadler for "backbutton" event on all screens. Also remove JS (where you check registration) from onLoad event and put it on Page Show event.

Return to “Issues”