2011-11-01 91 views
1

我想從我的應用程序中打開Facebook應用程序。如果安裝了,我想打開Facebook應用程序窗口,而不是Facebook的彈出窗口。android如何在手機中安裝facebook應用程序

我該怎麼做?

+0

代碼如何打開Facebook的應用程序窗口,如果沒有安裝? –

+0

不,如果安裝我怎樣才能打開應用程序窗口而不是彈出窗口 – Jyosna

+0

什麼彈出窗口?如果應用程序未安裝,您**不能**打開應用程序。您可以做的最好的方法是向用戶顯示一條警告,指出應用程序未安裝。 –

回答

0

它出現在Facebook Android SDK中。當您需要繼續使用FB登錄時,SDK會打開FB應用程序,而不是如果安裝了彈出警報。

這裏的(從Facebook SDK code

/* 
    * Copyright 2010 Facebook, Inc. 
    * 
    * Licensed under the Apache License, Version 2.0 (the "License"); 
    * you may not use this file except in compliance with the License. 
    * You may obtain a copy of the License at 
    * 
    * http://www.apache.org/licenses/LICENSE-2.0 
    * 
    * Unless required by applicable law or agreed to in writing, software 
    * distributed under the License is distributed on an "AS IS" BASIS, 
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
    * See the License for the specific language governing permissions and 
    * limitations under the License. 
    */ 
public class Facebook { 
... 

     /** 
     * Internal method to handle single sign-on backend for authorize(). 
     */ 
      private boolean startSingleSignOn(Activity activity, String applicationId, 
        String[] permissions, int activityCode) { 
       boolean didSucceed = true; 
       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 FB app signature. 
       if (!validateAppSignatureForIntent(activity, intent)) { 
        return false; 
       } 

       mAuthActivity = activity; 
       mAuthPermissions = permissions; 
       mAuthActivityCode = activityCode; 
       try { 
        activity.startActivityForResult(intent, activityCode); 
       } catch (ActivityNotFoundException e) { 
        didSucceed = false; 
       } 

       return didSucceed; 
      } 
... 
} 
+0

哪裏可以獲得應用程序ID? – Jyosna

+0

@Jyosna sandrstar發佈了來自Facebook SDK的代碼片段。你不必擔心它是如何工作的。 Sandrstar的觀點是,你不能導航到Facebook的應用程序沒有登錄。 –

+0

亞一,我有,但我想從我的應用程序按鈕點擊它應該去facebook應用程序,我該怎麼做 – Jyosna

相關問題