我有一個關於Android Facebook API singleSignOn()方法的問題。Android Facebook API單點登錄?
以下代碼使用包「com.facebook.katana」和類「com.facebook.katana.proxyAuth」。
問題是我的Eclipse安裝中沒有這樣的包和類,但似乎使用這些包和類的活動很好 - 即使我沒有。爲什麼?
線
activity.startActivityForResult(intent, activityCode);
不會拋出ActivityNotFoundException
錯誤,即使我沒有合適的包?
的代碼是在這裏:
private boolean startSingleSignOn(Activity activity, String applicationId,
String[] permissions, int activityCode) {
boolean didSucceed = true;<br>
Intent intent = new Intent();
intent.setClassName("com.facebook.katana",
"com.facebook.katana.ProxyAuth");
intent.putExtra("client_id", applicationId);
if (permissions.length > 0) {
intent.putExtra("scope", TextUtils.join(",", permissions));
}
// Verify that the application whose package name is
// com.facebook.katana.ProxyAuth has the expected
// Facebook app signature.
if (!validateAppSignatureForIntent(activity, intent)) {
Log.d("Facebook - startSignleSignOn", "AppSign Validation Failed, return didsucced false");
return false;
}
mAuthActivity = activity;
mAuthPermissions = permissions;
mAuthActivityCode = activityCode;
try {
activity.startActivityForResult(intent, activityCode);
} catch (ActivityNotFoundException e) {
Log.d("Facebok - startSingleSignOn", "Activity not found exception, return didsucced false");
didSucceed = false;
}
return didSucceed;
}
它仍然適合你嗎?當它打開Facebook應用程序對話框時,它會顯示「參數app_id是必需的」。 – dannyroa 2014-08-16 22:15:37