FacebookSdk 登入
FacebookSdk 登入 1﹒ 啟用『單一登入』 在自己的應用程式設定頁面內將最下方的『ToggleButton』改為是,記得要按下儲存變更 2﹒新增『Facebook 登入』按鈕 (Layout) 變登入按鈕必須要用FB客製化的『 Button 』,在需要用上的『 Layout 』頁面加上這個按鈕,可以只輸入第一行,其他設定可以去使用介面設定 <com.facebook.login.widget.LoginButton android:id="@+id/login_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="100dp" android:layout_marginTop="30dp" /> 3﹒增加程式部分 SDK提供的類別( LoginManager、CallbackManager、AccessToken、Profile ) 可將類別設定在這個 Activity 的欄位裡,再來一定要初始化FaceBookSdk,而且記得要放在 onCreate 裡面的 第一行 哦 再來連結程式與 Layout 的 linkButton 建立 CallbackManager 設定當LoginButton收到 回傳(Callback) 的處理動作: 成功、失敗、取消 這邊輸入完之後按下alt+enter會出現這個畫面,按下OK 按下OK會跑出下圖的程式碼,這些分別代表 成功( onSuccess )、失敗( onError )、取消( onCancel )