2012-01-11 20 views
1

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; 
} 

答えて

3

気にしません。 "com.facebook.katana"パッケージと "com.facebook.katana.ProxyAuth"クラスを見つけることができないときに、コードが自動的にwebview Facebookの承認を使用することがわかりました。

これらのパッケージとクラスはFacebookアプリケーションに含まれていると思います。だから、もし私が "com.facebook.katana.ProxyAuth"を含むFacebook公式アプリケーションを持っていれば、私のアプリケーションはSigleSignOnメソッドを使って、ユーザーがFacebookの公式アプリケーションにログオンしていれば私のアプリのFacebook認証をスキップできるようになります。 Facebookの公式アプリがないと、アプリは従来のwebview認証を使用します。

+0

それでも機能しますか? Facebook App Dialogを開くと、「パラメータapp_idは必須です」と表示されます。 – dannyroa

関連する問題