Phonegap facebook plugin: various issues with android

半腔热情 提交于 2019-12-23 20:13:32

问题


I'm trying to integrate Phonegap 3.1 with phonegap-facebook-plugin, to make my application able to login with facebook:

https://github.com/phonegap/phonegap-facebook-plugin

After various searches I found a way to make it work with last version of phonegap, but I'm having 2 main issues:

1) I really don't understand how to configure the "Native Android App" on facebook developer panel, in particular the "Class Name".

Information I found online are a bit confusing. I tried:

  • com.facebook.LoginActivity
  • my.app.main.activity
  • com.phonegap.plugins.facebookconnect

With both of them I receive this error in the logcat:

Failed to find provider info for com.facebook.katana.AttributionIdProvider

Even if this error is thrown, facebook login works, but:

2) FB.init returns status unknown even if I'm already logged and, when I call FB.login, I receive:

You already authorized appname.

It's a bit frustrating that the app user have to confirm authorization everytime he opens the app...

I'm doing something wrong?


回答1:


If someone is interested, I finally resolved leaving the facebook connect plugin and using facegap

It's incredibly simple to integrate.

EDIT:

example:

$(document).FaceGap({
    app_id      : 'xxxxxxxxxxxxxxxx',
    scope       : 'user_photos',
    host        : 'https://yourdomain.com', //App Domain ( Facebook Developer ).
    onLogin     : function (event)
    {
        if (event.message == "Success")
        {
            alert("LOGIN WORKED!");
        }
   },
    onLogout    : function (event) {
        if (event.status === 1)
        {
            alert("LOGOUT!");
        }
    }
});

Important: the host parameter must be a valid URL in your app domain (the one you set in the facebook app configuration). It could be also a blank page, it will be never be loaded, but needs to be a working url, in order to make facegap work.

I also created a fork with a bug fix and a new function (feed functionality):



来源:https://stackoverflow.com/questions/19786585/phonegap-facebook-plugin-various-issues-with-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!