android - How to handle errors using phonegap facebook connect plugin -
i using phonegap develop app on android , ios. far, have managed implement facebook connect plugin android , works pretty well.
there 1 thing unable do, how handle plugin errors. instance, when there no network connection, fb.login(...) not work , got alert facebook-js-sdk.js: line 5105 :
// cordova patch // if nativeinterface arg specified call out nativeinterface // uses native app rather using iframe / popup web if (fb._nativeinterface) { switch (params.method) { case 'auth.login': fb._nativeinterface.login(params, cb, function(e) {alert('cordova facebook connect plugin fail on login!' + e);}); break;
how can intercept alert , display own error? here code using login:
login: function(success, error) { fb.login(function(response) { if (response.authresponse) { //some code .. if (success && typeof(success) === "function") { success(); } } else { alert('user cancelled login or did not authorize.'); if (error && typeof(error) === "function") { error(false); } } }, {scope: 'email'}); }
ps: never enter in else
block if cancel login authorization, i've got same alert.
am missing something?
thank help.
Comments
Post a Comment