반응형
반응형

http://lynlab.co.kr/blog/41/

반응형
반응형

#[Open API] 페이스북 API 연동하기(2): https://developers.facebook.com/docs/facebook-login/android/


2-1. activity_main.xml에 페이스북 로그인 버튼 ui 추가

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"

    android:id="@+id/activity_main"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:paddingBottom="@dimen/activity_vertical_margin"

    android:paddingLeft="@dimen/activity_horizontal_margin"

    android:paddingRight="@dimen/activity_horizontal_margin"

    android:paddingTop="@dimen/activity_vertical_margin"

    tools:context="com.example.aileen.myapplication.MainActivity">

 

    <com.facebook.login.widget.LoginButton

        android:id="@+id/login_button"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_gravity="center_horizontal"

        android:layout_alignParentTop="true"

        android:layout_alignParentLeft="true"

        android:layout_alignParentStart="true"

        android:layout_alignParentRight="true"

        android:layout_alignParentEnd="true" />

 

</RelativeLayout>

 

2-2. MainActivity에 추가

--블라--

프레그 먼드트를 모루눈데.. 프레그먼트부터 공부하기

반응형
반응형

#Android에서 Facebook 로그인 붙이기 : https://developers.facebook.com/docs/facebook-login/android


  • 기본 순서
    1. 안드로이드 스튜디오 다운로드
    2. 페이스북 개발자 계정 생성
    3. 안드로이드 스튜디오에 페이스북 개발 환경 설정
    4. 페이스북 앱 아이디 추가
    5. 해시키 생성
    6. 해시키 등록


1-1. Android studio 설정하기 

repositories {
    jcenter()
    mavenCentral()
}
/app/build.gradle 파일의 repositories에 mavenCentral() 추가

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations
    })
    testCompile 'junit:junit:4.12
    compile 'com.android.support:appcompat-v7:25.1.1
    compile 'com.facebook.android:facebook-android-sdk:4.+
}

build.gradle 파일에 Facebook dependencies 추가


sync 클릭하여 프로젝트 빌드하기


1-2. Facebook 앱 ID 추가

<resources>

    <string name="facebook_app_id>페이스북 앱 id 정보를 넣어주기</string>

</resources>

/app/src/main/res/values/stringsxml 파일에 Facebook app ID 문자열 추가 

앱 아이디는 페이스북 개발자 계정을 생성했으면 자동으로 생성되며 (https://developers.facebook.com/apps/)에서 확인가능


<?xml version="1.0" encoding="utf-8?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android 

package="com.example.aileen.myapplication>

<application

android:allowBackup="true"

android:icon="@mipmap/ic_launcher"

android:label="@string/app_name"

android:supportsRtl=true

android:theme="@style/AppTheme>

<activity android:name=".MainActivity">

<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

</activity>

<uses-permission android:name="android.permission.INTERNET/>

</application>

</manifest>

인터넷을 사용하겠다는 권한 추가


1-3. 페이스북 해시키 생성하기

Mac

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

Windows

keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | openssl sha1 -binary | openssl
base64

cmd에서 해당 명령을 통하여 해시키 받기

  • "keytool명령어 라인 도구를 사용하려면 jdk를 설치해야 합니다.." 라는 말이 나오면서 명령어가 제대로 실행되지 않을 경우
  • jdk 다운로드 및 환경설정하기 : http://aileen93.tistory.com/43
gimminjeong-ui-MacBook-Pro:Home aileen$ keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

키 저장소 비밀번호 입력:  1234

z/g+u/Wxh90123+q50cI1j6N2gs=

gimminjeong-ui-MacBook-Pro:Home aileen$ 

정상적으로 해시키를 받았을 경우의 화면


1-4. 페이스북 앱에서 해당 해시키 등록하기



반응형
반응형

#안드로이드 스튜디오 jar 라이브러리 파일 추가하기

  1. 보기 설정을 Project로 변경하기
  2. build.gradle > dependencies > compile files('libs/라이브러리명.jar'
  3. Sync Now
  4. build > clean project


반응형
반응형

#[Android] Cannot checkout from svn: svn E155000: '경로' is already a working copy for diffent URL




방법1)

check-out 받을 디렉토리의 root에서 *.svn 파일들을 찾아 모두 삭제 후 다시 check-out 실행! 하지만, 나는 안먹혀서 다 삭제하고 다시 하는 중

반응형
반응형

#안드로이드 activity 종류 변경



반응형
반응형

#android layout title 없애기

1.타이틀바 상단 제목 없애기

2.엠프티로 생성해서 상단 제목 추가하기


반응형
반응형

#안드로이드 액티비티간의 데이터 전달 (intent 사용법) - 2


  • 인텐트를 통해서 클래스 객체나 컴포넌트 이름을 지정하여 호출할 대상을 정확히 아는 경우에는 '명시적인 인텐트(Explicit Intent)'
  • 액션과 데이터를 지정 하긴 했지만 호출할 대상이 달라질 수 있는 경우에는 '암시적인 인텐트(Implicit Intent)'

* 명시적인 인텐트와 암시적인 인텐트의 예시

전화번호 다이얼로 액티비티 띄우기(Action), 특정 A라는 액티비티로 데이터 전달을 할 경우 등등은 명시적인 인텐트라고 하며 암시적인 인텐트는 어떠한 걸 띄우기 잘 모를때 사용하는 것으로 만약 pdf나 문서 편집 어플을 통해서 보여줘야할 경우, 암시적인 인텐트를 통해서 휴대폰 단말기에 설치된 앱들 중에서 적절한 어플을 실행 시킬 수 있다.



반응형

+ Recent posts