我想PhoneGap的3.1集成的PhoneGap,Facebook的插件,让我的应用程序能够登录facebook:
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
各种搜索之后,我找到了一种方法,使其与PhoneGap的最后的版本,但我有两个主要问题:
After various searches I found a way to make it work with last version of phonegap, but I'm having 2 main issues:
1)我真的不知道如何Facebook开发面板上配置了原生Android应用程序,特别是类名。
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随着他们两人我在logcat中收到此错误:
With both of them I receive this error in the logcat:
无法找到com.facebook.katana.AttributionIdProvider提供商信息
Failed to find provider info for com.facebook.katana.AttributionIdProvider
即使这个错误被抛出,Facebook的登录工作,但:
Even if this error is thrown, facebook login works, but:
2)FB.init返回状态未知的,即使我已经登录,当我打电话FB.login,我收到了:
2) FB.init returns status unknown even if I'm already logged and, when I call FB.login, I receive:
您已经授权的应用程序名称的。
这是一个有点沮丧的应用程序,用户必须确认授权每次他打开应用程序...
It's a bit frustrating that the app user have to confirm authorization everytime he opens the app...
我做错了什么?
如果有人有兴趣,我终于下定了决心离开Facebook的连接插件和使用的 facegap
If someone is interested, I finally resolved leaving the facebook connect plugin and using facegap
这是令人难以置信的简单集成。
It's incredibly simple to integrate.
编辑:
例如:
$(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!");
}
}
});
重要:主机
参数必须是有效 URL在你的应用程序域(你的Facebook应用程序配置中设置的一个)。它可能是也空白页,将永远不会被加载,但需要有一个工作URL,以使facegap工作
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.
我还创建了一个叉有bug修复和新的功能(进给功能):
I also created a fork with a bug fix and a new function (feed functionality):