using phonegap-facebook-plugin in simple cordova android app -


i trying facebook-plugin on this link working on android emulator after building using cordova

i have used below login function (given example on github documentation page) after viewready has been fired.

facebookconnectplugin.getloginstatus(             function(response) {                 alert(json.stringify(response));             },             function(response) {                 alert(json.stringify(response));             }); 

my app crashes message "unfortunately app has stopped working". have done following steps till : -- create new cordova project

--add android platform it

--add phonegap plugin cordova project below command

cordova -d plugin add /users/your/path/here/phonegap-facebook-plugin --variable app_id="123456789" --variable app_name="myapplication" 

--added keyhash facebook developer account well

--added faceboook-android-sdk reference using below command inside platforms/android

android update project --target 3 --path . --library ../../facebook/ 

--build , run on emulatorusing below command

cordova emulate android 

i read many forums , this blogpost finding solution , of them use below code

if (typeof cdv === 'undefined') {     alert('cdv variable not exist. check have included cdv-plugin-fb-connect.js correctly'); } if (typeof fb === 'undefined') {     alert('fb variable not exist. check have included facebook js sdk file.'); }  document.addeventlistener('deviceready', function() {     try {         fb.init({             appid: "your_fb_app_id",             nativeinterface: cdv.fb,             usecacheddialogs: false         });     } catch (e) {         alert(e);     } }, false); 

the issue 2 files(cdv-plugin-fb-connect.js , facebook js sdk file ) mentioned in code above , talking found in folder downloaded github page.

as per understand , though haven't installed facebook app in emulator, plugin should open web view login screen if call login function. app crashes if write login code posted above.

any appreciated.

that documentation deprecated, try this:

facebookconnectplugin.login(['public_profile'],     function(response) {         alert(json.stringify(response));     },     function(response) {         alert(json.stringify(response));     }); 

but wouldn't lot because stuck in next step, facebook not run callbacks functions @ login method, please let me know if login method work you.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -