개발환경
- MacBook, macOS Sequoia 15.3.2
- Android Studio, Meerkat | 2024.3.1
프로젝트 저장할 폴더 선택 후, 시뮬레이터 실행으로 정상 작동 확인
모듈 설치 - 가이드
//settings.gradle.kts
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url = java.net.URI("https://devrepo.kakao.com/nexus/content/groups/public/") }
}
}
//build.gradle.kts(Module)
dependencies {
implementation(libs.kakao.sdk)
...
//libs.versions.toml
[libraries]
kakao-sdk = { group = "com.kakao.sdk", name = "v2-all", version.ref = "kakaoSdk" }
인터넷 사용 권한 - 가이드
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sample">
<!-- 인터넷 사용 권한 설정-->
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
...
초기화 - 가이드
//GlobalApplication.kt
package com.example.kakaosdk
import android.app.Application
import com.kakao.sdk.common.KakaoSdk
class GlobalApplication : Application() {
override fun onCreate() {
super.onCreate()
// Kakao SDK 초기화
KakaoSdk.init(this, "{NATIVE_APP_KEY}")
}
}
//AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<!-- 인터넷 사용 권한 설정-->
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".GlobalApplication"
Redirect URI 설정, 커스텀 URL 스킴 (카카오톡에서 앱으로 되돌아갈 주소 설정) - 가이드
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<!-- 인터넷 사용 권한 설정-->
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".GlobalApplication"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.KakaoSDK"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.KakaoSDK">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.kakao.sdk.auth.AuthCodeHandlerActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Redirect URI: "kakao${NATIVE_APP_KEY}://oauth" -->
<data android:host="oauth"
android:scheme="kakao${NATIVE_APP_KEY}" />
</intent-filter>
</activity>
</application>
</manifest>
구현 - 가이드
https://github.com/kakao-tam/kakaoSDK-android-demo.git
GitHub - kakao-tam/kakaoSDK-android-demo: kakaoSDK-android-demo
kakaoSDK-android-demo. Contribute to kakao-tam/kakaoSDK-android-demo development by creating an account on GitHub.
github.com
'언어, 환경별 예제 코드' 카테고리의 다른 글
iOS, swift UI 카카오 SDK 사용하기 (0) | 2025.03.25 |
---|---|
[rest api 예제] node.js- 카카오 로그인, 카카오 친구목록 조회, 메시지 발송 (0) | 2025.02.26 |
[rest api 예제] python (Flask) - 카카오 로그인, 카카오 친구목록 조회, 메시지 발송 (0) | 2025.02.26 |
[rest api 예제] next.js- 카카오 로그인, 카카오 친구목록 조회, 메시지 발송 (0) | 2025.02.26 |
Java에서 API 호출 후, Error Body 조회하는 방법 (0) | 2024.10.17 |
댓글