Facebook在Android中使用不同的设备登录 [英] Facebook Login in android with different devices

查看:234
本文介绍了Facebook在Android中使用不同的设备登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用facebook登录Android应用程序时遇到问题。我正在使用Facebook sdk 3.0.1。我在三星galaxy y和模拟器上运行它工作正常。但是在三星注意到,intex aqua和nexus 5它不起作用。我尝试再次构建和清理项目,但问题仍然存在。我附上了intex aqua设备的日志:

I am having a problem with using facebook login for android app. I am using Facebook sdk 3.0.1 for this. I am running on Samsung galaxy y and emulators it works fine. But on samsung note, intex aqua and nexus 5 it doesn't work. I tried building and cleaning the project again but still the problem persists. I am attaching the log of the intex aqua device:

08-09 11:01:56.850: W/com.facebook.Session(11390): Should not pass a read permission (offline_access) to a request for publish or manage authorization
08-09 11:01:56.850: W/com.facebook.Session(11390): Should not pass a read permission (email) to a request for publish or manage authorization
08-09 11:01:56.851: W/com.facebook.Session(11390): Should not pass a read permission (user_photos) to a request for publish or manage authorization
08-09 11:01:56.851: W/com.facebook.Session(11390): Should not pass a read permission (photo_upload) to a request for publish or manage authorization
08-09 11:01:56.851: W/com.facebook.Session(11390): Should not pass a read permission (read_stream) to a request for publish or manage authorization
08-09 11:02:32.603: W/Insideeee(11494): Insideeee
08-09 11:02:32.651: D/JpgDecHal(11494): JpgDecHal::JpgDecHal
08-09 11:02:32.651: D/JpgDecHal(11494): JpgDecHal::~JpgDecHal
08-09 11:02:32.652: D/JpgDecHal(11494): JpgDecHal::JpgDecHal
08-09 11:02:32.652: D/JpgDecHal(11494): JpgDecHal::start -> config jpeg path
08-09 11:02:32.652: D/JpgDecHal(11494): Decoder Src Addr:0x4501f008, width/height:[264, 65]           
08-09 11:02:32.652: D/JpgDecHal(11494): Decoder Dst Addr:0x45030000, width/height:[264, 65], format:3
08-09 11:02:32.653: D/JpgDecHal(11494): Decoder Dither:0, RangeDecode:0 [1868771184 1882089569 1702440557 1818456179]
08-09 11:02:32.654: D/JpgDecHal(11494): jpeg decoder result:0
08-09 11:02:32.655: D/JpgDecHal(11494): JpgDecHal::~JpgDecHal
08-09 11:02:32.682: D/JpgDecHal(11494): JpgDecHal::JpgDecHal
08-09 11:02:32.682: D/JpgDecHal(11494): JpgDecHal::~JpgDecHal
08-09 11:02:32.683: D/JpgDecHal(11494): JpgDecHal::JpgDecHal
08-09 11:02:32.683: D/JpgDecHal(11494): JpgDecHal::start -> config jpeg path
08-09 11:02:32.683: D/JpgDecHal(11494): Decoder Src Addr:0x4501f008, width/height:[144, 80]           
08-09 11:02:32.683: D/JpgDecHal(11494): Decoder Dst Addr:0x45032000, width/height:[144, 80], format:3
08-09 11:02:32.683: D/JpgDecHal(11494): Decoder Dither:0, RangeDecode:0 [0 0 0 0]
08-09 11:02:32.686: D/JpgDecHal(11494): jpeg decoder result:0
08-09 11:02:32.686: D/JpgDecHal(11494): JpgDecHal::~JpgDecHal

记录三星注:

08-09 11:20:31.225: W/isSessionValid(14609): isSessionValidfalse
08-09 11:20:31.225: W/Button Clicked(14609): Button Clickedd
08-09 11:20:31.230: W/com.facebook.Session(14609): Should not pass a read permission (offline_access) to a request for publish or manage authorization
08-09 11:20:31.230: W/com.facebook.Session(14609): Should not pass a read permission (email) to a request for publish or manage authorization
08-09 11:20:31.230: W/com.facebook.Session(14609): Should not pass a read permission (user_photos) to a request for publish or manage authorization
08-09 11:20:31.230: W/com.facebook.Session(14609): Should not pass a read permission (photo_upload) to a request for publish or manage authorization
08-09 11:20:31.230: W/com.facebook.Session(14609): Should not pass a read permission (read_stream) to a request for publish or manage authorization
08-09 11:20:31.365: D/SensorManager(14609): unregisterListener:: Trklfufi 9 budiwrd5mrfo5WirfulblrwuFmfulTrklfufi$KfukwiFmfulTrklfufiRvht@,*f.,-+8
08-09 11:20:31.365: D/Sensors(14609): Remain listener = Sending .. normal delay 200ms
08-09 11:20:31.365: I/Sensors(14609): sendDelay --- 200000000
08-09 11:20:31.365: D/SensorManager(14609): JNI - sendDelay
08-09 11:20:31.370: I/SensorManager(14609): Set normal delay = true
08-09 11:20:41.315: D/SensorManager(14609): registerListener :: handle = 0  name= K3DH Acceleration Sensor delay= 200000 Trklfufi 9 budiwrd5mrfo5WirfulblrwuFmfulTrklfufi$KfukwiFmfulTrklfufiRvht@,*f.,-+8

编辑:

Session session = Session.getActiveSession();
if(session.isOpened())
          {
              //some code
          }
          else
          {
              //some code
          }

任何帮助都会很明显。

推荐答案

问题我是我上传的哈希密钥,我从下面的代码得到的是不同的。这就是因为当Facebook应用程序安装在设备上时,它没有获得用户登录的会话。因此,我编写了这段代码,得到了哈希,在我的控制台上更新并且喔..我的登录完美了。我发布这个,以便我的开发人员节省一些时间来解决这个问题。

The problem i was the hash key that i have uploaded and that i got from the code below were different. That was the reason that when facebook app was installed on the device it did not get the logged in session of the user. Thus I wrote this code, got the hash, updated on my console and woo.. i got the login perfect. I am posting this so that my fellow developer save some time that i have spent in solving this problem.

try {
PackageInfo info = getPackageManager().getPackageInfo(
      "com.facebook.samples.loginhowto", PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures){
       MessageDigest md = MessageDigest.getInstance("SHA");
       md.update(signature.toByteArray());
       Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}

这篇关于Facebook在Android中使用不同的设备登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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