PhoneGap的,Facebook的插件:只有在没有安装本地应用程序FB作品(Android版) [英] phonegap-facebook-plugin: only works when native FB app is not installed (Android)

查看:181
本文介绍了PhoneGap的,Facebook的插件:只有在没有安装本地应用程序FB作品(Android版)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用这个插件在我的PhoneGap应用程序Facebook的登录选项:
https://github.com/phonegap/phonegap-facebook-plugin

我已经遵循所有的步骤Android的入门,当我运行的设备(模拟器和真正的)应用程序,一切工作正常,不安装官方的Facebook应用程序。当我在安装了Facebook应用程序正式在设备上运行它,我点击登录按钮,Facebook的对话出现,它要求的权限。我选择确定,对话消失,没有任何反应。没有错误或其他警报出现,我不都没有记录下来。

我该如何解决这个问题?

JavaScript的:

 函数注销(){
    FB.logout(功能(响应){
              警报('退出');
              });
}
功能登录(){     尝试{
          FB.init({APPID:*****************,nativeInterface:CDV.FB,useCachedDialogs:假});          }赶上(E)
          {
          警报(错误);
          }    FB.login(
             功能(响应){
             如果(response.authResponse){              //不会被调用
              警报('登录');
             }其他{
              //不会被调用
             警报('错误');
             }
             },
             {范围:电子邮件}
             );}


解决方案

谢谢你给我说有事情做与FB应用setttings提示:在我的情况,之所以这个问题(PhoneGap的,Facebook的插件:当没有安装本地FB程序只适用(Android版))是,我没有公布,签署Android应用程序,这是使用PhoneGap的,Facebook的插件

我在释放模式签署了我的Andr​​oid应用程序之后(与被用于生成密钥散列密钥库),应用程序甚至安装了FB应用工作。

一个侧面说明:感谢所有贡献者的计算器!如果没有这些提示和放大器;技巧与放大器;提示像这样的,我将永远无法做我的工作。

I'm using this plugin to have a facebook-login option in my Phonegap app: https://github.com/phonegap/phonegap-facebook-plugin.

I've followed all the steps in the Android 'getting started' and everything works fine when I run the app on a device (emulator and real) that doesn't have the official Facebook app installed. When I run it on a device which has the official Facebook app installed and I click on the login button, the Facebook dialogue appears and it asks for permission. I choose OK, the dialogue disappears and nothing happens. No error or other alert appears and I'm not logged in neither.

How can I fix this?

The javascript:

function logout() {
    FB.logout(function(response) {
              alert('logged out');
              });
}


function logIn() {

     try {
          FB.init({ appId: "*****************", nativeInterface: CDV.FB, useCachedDialogs: false });

          } catch (e) 
          {
          alert("error");
          }

    FB.login(
             function(response) {
             if (response.authResponse) { 

              // not invoked
              alert('logged in');      


             } else {
              // not invoked
             alert('error');
             }
             },
             { scope: "email" }
             );

}

解决方案

Thanks for giving me the hint that it has something to do with the FB app setttings: in my case, the reason for this problem (phonegap-facebook-plugin: only works when native FB app is not installed (Android)) was, that I did not release-sign the Android app, that was using the phonegap-facebook-plugin.

After I signed my Android App in release mode (with the keystore that was used to generate the key hash), the app worked even with the FB App installed.

A side note: thank you to all the contributors on stackoverflow!! Without those tips & tricks & hints like this one, I would never be able to do my work.

这篇关于PhoneGap的,Facebook的插件:只有在没有安装本地应用程序FB作品(Android版)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆