facebook - FacebookConnect plugin with phonegap adobe build not working -


i have phonegap projct being built adobe build.

i want integrate facebookconnect per git / tutorial page : https://github.com/phonegap-build/facebookconnect

this adobe build config.xml :

<?xml version="1.0" encoding="utf-8"?> <widget xmlns= "http://www.w3.org/ns/widgets"  xmlns:gap= "http://phonegap.com/ns/1.0"  id= "com.tombers.foodidapp"  version = "0.0.1">   <cordova>     <preference name="keyboarddisplayrequiresuseraction" value="true" />     <preference name="suppressesincrementalrendering" value="false" />     <preference name="uiwebviewbounce" value="true" />     <preference name="topactivityindicator" value="gray" />     <preference name="enablelocation" value="false" />     <preference name="enableviewportscale" value="false" />     <preference name="autohidesplashscreen" value="true" />     <preference name="showsplashscreenspinner" value="true" />     <preference name="mediaplaybackrequiresuseraction" value="false" />     <preference name="allowinlinemediaplayback" value="false" />     <preference name="backupwebstorage" value="cloud" />     <preference name="orientation" value="portrait" /> <preference name="phonegap-version" value="2.5.0" />     <content src="index.html" />        <plugins>         <plugin name="device" value="cdvdevice" />         <plugin name="logger" value="cdvlogger" />         <plugin name="compass" value="cdvlocation" />         <plugin name="accelerometer" value="cdvaccelerometer" />         <plugin name="camera" value="cdvcamera" />         <plugin name="networkstatus" value="cdvconnection" />         <plugin name="contacts" value="cdvcontacts" />         <plugin name="debug console" value="cdvdebugconsole" />         <plugin name="echo" value="cdvecho" />         <plugin name="file" value="cdvfile" />         <plugin name="filetransfer" value="cdvfiletransfer" />         <plugin name="geolocation" value="cdvlocation" />         <plugin name="notification" value="cdvnotification" />         <plugin name="media" value="cdvsound" />         <plugin name="capture" value="cdvcapture" />         <plugin name="splashscreen" value="cdvsplashscreen" />         <plugin name="battery" value="cdvbattery" />         <plugin name="globalization" value="cdvglobalization" />         <plugin name="inappbrowser" value="cdvinappbrowser" />         <plugin name="com.phonegap.facebook.connect" value="com.phonegap.facebook.connectplugin" />         <gap:plugin name="facebookconnect">    <param name="app_id" value="133914256793487" />  </gap:plugin>     </plugins>        <access origin="*" /> </cordova> </widget> 

i added various javascript scraps , buttons shown in simple example : https://github.com/phonegap-build/facebookconnect/tree/master/example/simple including :

  document.addeventlistener('deviceready', function() {                                       try {                                       alert('device ready! make sure set app_id below alert.');                                       fb.init({ appid: "133914256793487", nativeinterface: cdv.fb, usecacheddialogs: false });                                       document.getelementbyid('data').innerhtml = "";                                       } catch (e) {                                       alert(e);                                       }                                       }, false); 

with updated appid. when app loads - alert saying device ready!

then 2 more alerts, 1 saying : plugin fail on init.

then 1 saying : plugin fail on auth.status.

i have added android debug keystore hash app on facebook + developer settings.

i not sure how debug here.

cheers,

andy

i suggest use inappbrowser plugin instead... example shown below. fill in xxx below relevant info

var my_client_id = "xxxxxx", // app id     my_secret = "xxxxxxxxx", // app secret      my_redirect_uri = "https://www.facebook.com/connect/login_success.html", // leave     my_type ="user_agent", my_display = "touch"; // leave  var facebook_token = "fbtoken"; // our token keeper var ref; //in app browser reference  // facebook var facebook = {     init:function(){          // begin authorization          var authorize_url = "https://www.facebook.com/dialog/oauth?";          authorize_url += "client_id=" + my_client_id;          authorize_url += "&redirect_uri=" + my_redirect_uri;          authorize_url += "&display=" + my_display;          authorize_url += "&scope=publish_stream";               //call in app browser link          ref = window.open(authorize_url, '_blank', 'location=no');           ref.addeventlistener('loadstart', function(event){               facebook.facebooklocchanged(event.url);            });      },     facebooklocchanged:function(loc){          if (loc.indexof("code=") >= 1  ) {              //close inappbrowser , navigate index             ref.close();              //this meant done on server side protect client secret             var codeurl = 'https://graph.facebook.com/oauth/access_token?client_id='+my_client_id+'&client_secret='+my_secret+'&redirect_uri='+my_redirect_uri+'&code='+loc.split("=")[1];             console.log('code_url::' + codeurl);             $.ajax({                 url: codeurl,                 data: {},                 type: 'post',                 async: false,                 cache: false,                 success: function(data, status){                     //we store token here                     localstorage.setitem(facebook_token, data.split('=')[1].split('&')[0]);                     },                 error: function(){                     alert("unknown error occured");                 }             });          }     } 

i add more functions logout , posting wall etc. can find documenatation on inappbrowser here


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -