2013-10-05 2 views
1

사용자가 페이스 북 로그인 버튼을 클릭 할 때 사용자의 데이터를 가져 오기 위해 페이스 북 API를 구현하고 싶습니다. 그게 .. 클릭 .. json 파일을 잡고 돌려 보내라.안드로이드에서 페이스 북 로그인을 올바르게 구현하는 방법

문제는 개발자 가이드가 다소 힘들고 자습서와 게시물 및 찾은 항목이 매우 오래되어 사용되지 않는 코드를 사용한다는 것입니다. 그래서 붙어 있어요 내가 관리해온 것 코드는 다음과 같습니다

레이아웃 :

<com.facebook.widget.LoginButton 
      xmlns:fb="http://schemas.android.com/apk/res-auto" 
      android:id="@+id/login_button" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_horizontal" 
      fb:login_text="@string/registrarse_con_facebook" />  

자바 :

//global variable 
LoginButton btnRegisterFb; 

. 
. 
@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_register_user); 


    btnRegisterFb = (LoginButton)findViewById(R.id.login_button); 

    //permissions is an array of strings with permissions needed 
    btnRegisterFb.setReadPermissions(Arrays.asList(FacebookHelper.permissions)); 


} 

내가이 주제에 몇 가지 지침을 사랑합니다.

어떻게 로그인 대화 상자를 표시 할 수 있습니까? 어떻게 사용자 데이터를 가져올 수 있습니까?

+0

간단한 방법으로 원하십니까? 이 도서관을 이용하십시오 : https://github.com/sromku/android-simple-facebook – sromku

+0

감사합니다 :) 나는 그것을 검사 할 것입니다 – HardCodeStuds

+0

나는 안드로이드에서 http를 사용하여 페이스 북을위한 로그인 페이지를 만들었습니다 ... 그것을 원합니까? ? 프로젝트는 푸시 알림을 처리하지 않으며 연락처를 가져 오지 않고 일반적으로 페이스 북 응용 프로그램이 수행하는 다른 작업을 수행하지 않습니다. 그냥 fb에 로그인하여 fb 홈 페이지를 표시합니다. –

답변

0
<activity 
     android:name="com.facebook.LoginActivity" 
     android:label="@string/app_name" 
     android:screenOrientation="portrait" 
     android:theme="@android:style/Theme.NoTitleBar.Fullscreen" > 
    </activity> 
<string name="applicationId">ur app id </string> 



<meta-data 
      android:name="com.facebook.sdk.ApplicationId" 
      android:value="@string/applicationId" />