5

Someone ever created a Native Android/iOS app in Sencha Touch and implement Facebook authentication? If so can you please share your code/method? I already go through this link https://developers.facebook.com/docs...login/devices/ but seems Facebook yet not supporting it.

All I want to provide a simple button in app and get user's Auth token from Facebook and package this app in Native.

The above question was unanswered in sencha fourum. I have copied here for larger audience, and require your suggestions as i am trying to accomplish the same.Link to Sencha forum

regards Punith

SachinGutte
  • 6,947
  • 5
  • 35
  • 58
Punith Raj
  • 2,164
  • 3
  • 27
  • 45
  • are you using Phonegap? – Nico Grunfeld Aug 01 '13 at 14:53
  • `please share your code/method` is not a way to seek help. SO community will help you write your own code if you post enough efforts and research. Regarding question, you might want to clear some things first. Are you using phonegap or you planning to use facebook js sdk w/o phonegap ? – SachinGutte Aug 01 '13 at 19:38
  • if options are good using an another framework like phonegap, i am willing to leverage it. i had done small homework, before asking the question here. unable to fully understand the concept and lack of resources available on sencha touch integration. this was the only hope left. – Punith Raj Aug 02 '13 at 11:15
  • @NicoGrunfeld, as of now i am not using it. i need the Facebook login page as it opens in the web-browser. apps like jogwithfriends and other use an extra proxy layer with php to achieve it, which i dont want to. also google oauth does not support jsonp for cross domain. – Punith Raj Aug 02 '13 at 11:18
  • @all, above all of this, my insufficient knowledge on advanced javascript is stopping me from more exploration... i am thinking to develop my application in the native application library .. – Punith Raj Aug 02 '13 at 11:19
  • Im not 100% sure but I think it should work with phonegap's inAppBrowser. Let me now if thats an option for you, I have some snippets working with twitter and instagram – Nico Grunfeld Aug 02 '13 at 21:15
  • @NicoGrunfeld, thank you so much. But as i said above, my insufficient knowledge on advanced JS has stopped me. i know there are lot of advantages to develop as hybrid app, but as of now i am thinking to go with native app. some time in future i will try to gain knowledge on JS – Punith Raj Aug 06 '13 at 11:13

1 Answers1

1

I made a Sencha Touch app built with PhoneGap and hosted on both major store (Google Play and Apple Store) with a FB share function. I've used the "FacebookConnect" plugin of PhoneGap (https://github.com/phonegap/phonegap-plugins/tree/master/Android/FacebookConnect). I've used the folowing code to share a link:

window.plugins.facebookConnect.dialog('feed',
  {
    link: mylink,
    picture: mypicture, // provide not a local url. otherwise, FB does not display nothing and rises an "FBCDN image is not allowed in stream" error
    name: myname,
    caption: mycaption,
    description: mydescription
  },
  function(response) {
    console.log("FacebookConnect.dialog:" + JSON.stringify(response));
  }
);

If not already logged in on FB (using, for example, the FB native app if installed), the plugin will show the web-based login window to the user before open the share dialog.

Before that, remember to init the FB API using something like that somewhere in your app:

window.plugins.facebookConnect.initWithAppId(FBID, function(result) {
  console.log("FacebookConnect.initWithAppId: " + JSON.stringify(result));

  // Check for cancellation/error
  if(result.cancelled || result.error) {
    console.log("FacebookConnect.initWithAppId:failedWithError: " + result.message);
    return;
  }
});

also remember to NOT call the FB API login method at the startup of the app,otherwise Apple will reject application.

I hope this is useful to your project.

Claudio Bertozzi
  • 536
  • 4
  • 12
  • https://github.com/phonegap/phonegap-plugins/tree/master/Android/FacebookConnect Link is deprecated. For detail Check https://github.com/phonegap/phonegap-plugins/ – Waqas Ghouri Jan 14 '14 at 13:36
  • Did you generate the PhoneGap project with Sencha command line tool, or did you put the sencha code under www/ folder of phonegap? – ethanjyx Apr 07 '14 at 00:30