본문 바로가기메인 메뉴 바로가기사이드 메뉴 바로가기

kakao developers

Related sites
  • Docs
  • Kakao Talk Social
  • Android

사이드 메뉴

Kakao Map

Search

Kakao Talk Social

Android

This document describes how to integrate Kakao Talk Social APIs into your service with the Kakao SDK for Android ("Android SDK").

Retrieve Kakao Talk profile

Basic information
ReferenceApp setting
[SDK, RxSDK] profile()
[SDK] TalkProfile
Install
Initialize
PermissionPrerequisiteKakao LoginUser consent
-Native app key
Activate Kakao Login
Manage consent items
RequiredRequired:
Profile Info(nickname/profile image)
Nickname
Profile image

Retrieves Kakao Talk profile information linked to the Kakao Account of the logged-in user.

Kakao Talk profile and Kakao Account profile

You can check the types and differences of user profiles available through the Kakao API in User profile.

Request

Call profile().

Response

profile() returns the TalkProfile object which contains the user's Kakao Talk profile information.

The Kakao Talk profile obatained though profile() is different from the profile of Kakao Account. Refer to REST API.

Sample

// Retrieve Kakao Talk profile
TalkApiClient.instance.profile { profile, error ->
if (error != null) {
Log.e(TAG, "Failed to retrieve Kakao Talk profile", error)
}
else if (profile != null) {
Log.i(TAG, "Succeeded in retrieving Kakao Talk profile" +
"\nNickname: ${profile.nickname}" +
"\nProfile Thumbnail: ${profile.thumbnailUrl}")
}
}

Retrieve friends through picker

Basic information
ReferenceApp setting
[SDK, RxSDK] selectFriend()
[SDK] OpenPickerFriendRequestParams
Install
Initialize
PermissionPrerequisiteKakao LoginUser consent
RequiredNative app key
Activate Kakao Login
Manage consent items
RequiredRequired:
Friends List in Kakao Service(Including profile image, nickname, and favorites)

Opens the Friend picker and returns the information of the Kakao Talk friends selected by the user.

Request

When calling selectFriend(), you can choose the display format and selection type of the Friend picker by specifying the corresponding parameters.

To use the full screen type Friend picker, set viewType to FULL. To use the popup view type, set it to POPUP.

To use the multi picker, set enableMulti to true. To use the single picker, set enableMulti to false. If not set, the multi picker is applied by default.

Other detailed settings such as picker orientation and search function can be modified by specifying OpenPickerFriendRequestParams. For more information on parameters, refer to the reference and Friend picker custom elements.

Response

If the request is successful, the information of the friends that a user selects from the Friend picker is returned through SelectedUsers. If you encounter errors, refer to Error code.

Sample

Full screen
val openPickerFriendRequestParams = OpenPickerFriendRequestParams(
title = "Single picker", // Name of the picker
viewAppearance = ViewAppearance.AUTO, // Display type
orientation = PickerOrientation.AUTO, // Orientation of the picker
enableSearch = true, // Enables the search function
enableIndex = true, // Enables the index view
showFavorite = true, // Marks on favorite friends
)
PickerClient.instance.selectFriend(
context = context!!,
params = openPickerFriendRequestParams,
viewType = ViewType.FULL,
enableMulti = false,
) { selectedUsers, error ->
if (error != null) {
Log.e(TAG, "Failed to retrieve the selected friend through the picker.", error)
} else {
Log.d(TAG, "Succeeded in retrieving the selected friend through the picker. $selectedUsers")
}
}
Popup
val openPickerFriendRequestParams = OpenPickerFriendRequestParams(
title = "Single picker", // Name of the picker
viewAppearance = ViewAppearance.AUTO, // Display type
orientation = PickerOrientation.AUTO, // Orientation of the picker
enableSearch = true, // Enables the search function
enableIndex = true, // Enables the index view
showFavorite = true, // Marks on favorite friends
)
PickerClient.instance.selectFriend(
context = context!!,
params = openPickerFriendRequestParams,
viewType = ViewType.POPUP,
enableMulti = false,
) { selectedUsers, error ->
if (error != null) {
Log.e(TAG, "Failed to retrieve the selected friend through the picker.", error)
} else {
Log.d(TAG, "Succeeded in retrieving the selected friend through the picker. $selectedUsers")
}
}

Retrieve list of friends

Basic information
ReferenceApp setting
[SDK, RxSDK] friends()
[SDK] Friends
Install
Initialize
PermissionPrerequisiteKakao LoginUser consent
RequiredNative app key
Activate Kakao Login
Manage consent items
RequiredRequired:
Friends List in Kakao Service (Including profile image, nickname, and favorites)

Retrieves Kakao Talk friend information linked to the Kakao Account of the logged-in user.

Note that Kakao Talk profiles may be different from Kakao Account profiles. Refer to Concepts.

Request

To get the list of Kakao Talk friends of the user currently logged in, call the friends() method in the TalkApiClient class. You can also pass optional parameters through arguments. If you make a request without any parameters, the default settings are applied.

Response

friends() returns Friends which contains a list of the user's Kakao Talk friends.

If the request fails because the user has not agreed to provide the Friends list, proceed the followings:

  • Check if 'Friends List in Kakao Service(Including profile image, nickname, and favorites)' is set to 'Consent during use' in Consent items.
  • Request additional consent to the 'Friends List in Kakao Service(Including profile image, nickname, and favorites)' scope.

Sample

// Retrieve a list of friends (Default)
TalkApiClient.instance.friends { friends, error ->
if (error != null) {
Log.e(TAG, "Failed to retrieve a list of friends.", error)
}
else if (friends != null) {
Log.i(TAG, "Succeeded in retrieving a list of friends. \n${friends.elements.joinToString("\n")}")
// You can send a message to the friends using their UUIDs.
}
}

Was this helpful?