Thursday 15 May 2014

cordova - Disable back button Android but not on Home Page using PhoneGap -



cordova - Disable back button Android but not on Home Page using PhoneGap -

i have disable android hardware button in phonegap project. however, if user in home page, want button function 1 time again , allow user go "list of apps" screen. there way how this? thanks

if know in home page can command behaviour...

something this:

document.addeventlistener("deviceready", ondeviceready, false); function ondeviceready(){ document.addeventlistener("backbutton", onbackkeydown, false); } function onbackkeydown(ev){ // if class 'home' nowadays in first div within #container div var home = $("#container div:first-child").hasclass("home"); if(home){ console.log("exit app<----------"); navigator.app.exitapp(); } ev.preventdefault(); }

i command using class in div, in other way...

android cordova

No comments:

Post a Comment