我已经集成了Facebook的SDK为Android V3.5在我的应用程序,其中包括安装出版code:
I have integrated the Facebook SDK for android v3.5 in my app and included the install publishing code:
com.facebook.AppEventsLogger.activateApp(this);
不过,我收到了很多造成事故的:
But I am receiving a lot of crashes caused by:
Settings.java line 418
com.facebook.Settings.getAttributionId
和它抛出异常:
java.lang.IllegalStateException: Orca SharedPreferences used before initialized
我一直在试图重现崩溃,但没有成功。有没有人遇到过这个问题?我只是想知道:
I have been trying to reproduce the crash with no success. Has anybody encountered this issue? I just want to know if:
/* Only activate FaceBook publish install if the user has the FaceBook app installed */
if (com.facebook.Settings.getAttributionId(getContentResolver()) != null){
com.facebook.AppEventsLogger.activateApp(this);
}
这将解决这一问题?谢谢!
this would fix the problem? Thanks!
我们终于通过捕捉异常,并避免为未安装Facebook应用程序的设备得到了激活修复了这个问题。 Facebook的开发人员回答我们:
We finally fixed this issue by catching the exception and avoiding that devices without an installed facebook app got activated. A facebook developer answered us:
用户需要有Facebook的Android应用程序安装在他们的设备上登录的activateApp正常工作。
"The user needs to have the Facebook Android app installed on their device and logged in for activateApp to function properly."
这是在code,我们终于用它isn't崩溃了:
This is the code we finally used and it isn´t crashing anymore:
try{
/* Only activate FaceBook publish install if the user has the FaceBook app installed */
if (com.facebook.Settings.getAttributionId(getContentResolver()) != null){
com.facebook.AppEventsLogger.activateApp(this);
}
} catch (IllegalStateException e){
Log.d(TAG, "Facebook Setting Exception again!");
}
我希望这可以帮助别人......
I hope this helps others...
上一篇:Android的HTTP测试与Robolectric测试、Android、HTTP、Robolectric
下一篇:Android的 - Facebook的登录只对第一次引起onResume错误只对、错误、Android、Facebook