Page 1 of 2
back button Android
Posted: Fri Aug 03, 2012 6:46 pm
by Emmz
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.
back button Android
Posted: Fri Aug 03, 2012 7:58 pm
by maxkatz
back button Android
Posted: Fri Aug 03, 2012 9:46 pm
by Emmz
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
back button Android
Posted: Tue Aug 07, 2012 8:44 am
by Maryna Brodina
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?
back button Android
Posted: Fri Aug 10, 2012 7:54 pm
by Emmz
Ok. Sent u an email with info..
Samsung Galaxy s II Android 2.3.5
back button Android
Posted: Mon Aug 13, 2012 1:43 pm
by Maryna Brodina
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.
back button Android
Posted: Mon Aug 13, 2012 4:16 pm
by Ralph
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!??).
Once I removed the check from that box, everything worked just swell.
Ralph
back button Android
Posted: Mon Aug 13, 2012 4:38 pm
by Emmz
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
back button Android
Posted: Mon Aug 13, 2012 4:41 pm
by Emmz
Thanks for the tip. But not using that function.
Tiggr.navigateTo('SCREEN_NAME',{}) Is Used.
Supposed to be axaj load
back button Android
Posted: Tue Aug 14, 2012 10:49 am
by Maryna Brodina
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.