28.1. Kakao Guild Chatting SDK Example
28.1. Kakao Guild Chatting SDK Example
28.1.1. Open chat room of guild joined by KakaoTalk.
This is an example of opening a chat room in the KakaoTalk guild.
Run KakaoTalk to open a chat room for your current guild.
If you have not left the guild, but have left the chat room in Kakao Talk, join the chat room again and open the chat room.
If KakaoTalk is not installed, the function will fail. (If you leave the chat room in KakaoTalk, you will join the chat room again.)
If no guild is subscribed, the function will fail.
Unity Example
using KakaoGame.SDK;
using KakaoGame.SDK.Kakao;
// [TODO] Set World ID
int worldId = 2344;
// [TODO] Set Guild ID
int guildId = 2354;
// Open the chat room of guild registered in KakaoTalk
KGKakaoGuildChat.OpenKakaoTalkGuildChat(
worldId,
guildId,
(result) => {
if (result.isSuccess) {
// Successfully opened chat room of guild registered in KakaoTalk
}
else {
// Failed to open guild chat room registered in Kakao Talk
if (result.code == KGResultCode.NotExistData)
{
// No guilds joined
}
else if (result.code == KGResultCode.KakaoTalkNotInstalled)
{
// KakaoTalk is not installed.
}
else
{
// Other errors
}
}
}); |
Android Example
// Set World ID
int worldId = 2344;
// Set Guild ID
int guildId = 2354;
// Open the chat room of guild registered in KakaoTalk
KGKakaoGuildChat.openKakaoTalkGuildChat(activity, worldId, guildId, new KGResultCallback<Void>() {
@Override
public void onResult(KGResult<Void> result) {
writeLog("KGKakaoGuildChat.openKakaoTalkGuildChat: " + result);
if (result.isSuccess()) {
// Successfully opened chat room of guild registered in KakaoTalk
} else {
// Failed to open guild chat room registered in Kakao Talk
if (result.getCode() == KGResult.KGResultCode.KAKAOTALK_NOT_INSTALLED) {
// KakaoTalk is not installed.
} else {
// Other errors
}
}
}
}); |
iOS Example
#import <KakaoGame/KakaoGame.h>
// [TODO] Set World ID
int worldId = 2344;
// [TODO] Set Guild ID
int guildId = 2354;
[KGKakaoGuildChat openKakaoTalkGuildChatWithWorldId:worldId guildId:guildId completionHandler:^(NSError *error) {
if (IS_SUCCESS(error) == YES)
{
// Successfully opened chat room of guild registered in KakaoTalk
}
else
{
// 카카오톡에서 가입된 길드의 채팅 방 열기 실패
if (result.code == KGErrorNotExistData)
{
// No guilds joined
}
else if (error.code == KGErrorKakaoTalkNotInstalled)
{
// KakaoTalk is not installed.
}
else if (error.code == KGErrorNotKakaoTalkUser)
{
// The logged-in user is not a "Kakao Talk" user. If you are not a KakaoTalk user with the account of a user who has just registered a kakao story.
}
else
{
// Other errors
}
}
}];
|
Windows Sync
Windows Async
Unreal
28.1.2. Send a message to the guild chat room
This is an example of sending a message to a guild chat room. (Guide : 20. Kakaotalk Message Template V2 )
Unity
Android
iOS
Windows Sync
Windows Async
Unreal
28.1.3. Show guild chat user consent window
This is an example of displaying the user consent window when the user does not agree to the use of the guild chat function when using the guild chat function.
Unity 예제
Android 예제
iOS 예제
Windows Sync
Windows Async
Unreal
Message Template V2
If you use Message Template V2, please refer to the following guide. (LINK)