버전 비교

  • 이 줄이 추가되었습니다.
  • 이 줄이 삭제되었습니다.
  • 서식이 변경되었습니다.

...

코드 블럭
#include "KakaoGameLib.h"
  
KakaoGame::API::KGKakaoTalkMessage kgKakaoTalkMessage;
 
// Displaying the setting view for KakaoTalk game message receipt
kgKakaoTalkMessage.showAllowMessageSettingView([this](KakaoGame::Data::KGResult result, bool isAllowedMessage) {
    if (result.isSuccess()) {
        // KakaoTalk game message receipt setup successful
        bool allowMessage = isAllowedMessage; // Configured message receipt option
    }
    else {
        // KakaoTalk game message receipt setup failed
    }
}, reinterpret_cast<HWND>(GEngine->GameViewport->GetWindow()->GetNativeWindow()->GetOSWindowHandle());

23.1.2. Querying KakaoTalk Game Friend List

This section shows an example of a query of the KakaoTalk game friend list.

UnityUnreal

코드 블럭
using Kakaogame.SDK;   KGPlayer.LoadFriendPlayers(     (result, players) => {         if (result.isSuccess) {             // Query of
#include "KakaoGame.h"
  
// Displaying the setting view for KakaoTalk game 
friend
message 
list successful.             foreach(var player in players) {                 var kakaoProfile = (KGKakaoProfile)player.idpProfile
receipt
FKGKakaoTalkMessage::ShowAllowMessageSettingView(FKGResultWithMessageAllowedValueDelegate::CreateLambda([=](FKGResult result, bool isAllowedMessage) {
  if (result.IsSuccess())
  {
    // KakaoTalk game message receipt setup successful
    bool allowMessage = isAllowedMessage; // 
Used
Configured 
for
message 
sending
receipt 
a game message             
option
  }
        }
  else
        else 
  {
            
      //
Query of
 KakaoTalk game message 
friend
receipt 
list
setup failed
.

        
  }
    
}));

Android

...

23.1.2. Querying KakaoTalk Game Friend List

This section shows an example of a query of the KakaoTalk game friend list.

Unity

코드 블럭
using Kakaogame.SDK;
 
KGPlayer.LoadFriendPlayers(
    (result, players) => {
        if (result.isSuccess
(
)
)
 {
            // 
Request
Query 
successful
of 
 
KakaoTalk 
            //
game 
Friend
friend list
            List<KGPlayer> friendList
 successful.
            foreach(var player in players) {
                var kakaoProfile = 
result.getContent
(
);                for (KGPlayer player : friendList) {                 KGKakaoProfile profile = (KGKakaoProfile) player.getIdpProfile()
KGKakaoProfile)player.idpProfile; // Used for sending a game message
            }
        }
 else 

        else {
            // 
Request
Query of KakaoTalk game friend list failed.
        }
    
}
});

iOSAndroid

코드 블럭
#import <KakaoGame
/
KakaoGame.h>   /
/ Querying KakaoTalk Game Friend List
 [KGPlayer loadFriendPlayersWithCompletionHandler:^(NSError *error, NSArray *players
KGPlayer.loadFriendPlayers(new KGResultCallback<List<KGPlayer>>() {
    @Override
    public void onResult(KGResult<List<KGPlayer>> result) {
    if (IS_SUCCESS(error) == YES)     {         
        if (result.isSuccess()) {
            // 
Query
Request 
of
successful
KakaoTalk
 
game
            // 
friend
Friend list
successful         for

            List<KGPlayer> friendList = result.getContent();
  
            for (KGPlayer 
*
player 
in
: 
players
friendList) 
        
{
            KGKakaoProfile
                KGKakaoProfile 
*kakaoProfile
profile = (KGKakaoProfile) 
*)
player.
idpProfile
getIdpProfile(); // Used for sending a game message
.

        
            }
    }     else     
        } else {
        
            // 
Query
Request 
of KakaoTalk game friend list failed
failed
        }
    }
}
]
);

Windows SynciOS

코드 블럭
#include "KakaoGameLib.h"   KakaoGame::Data::KGResult result; std::vector<KakaoGame::Data::KGPlayer> players; KakaoGame::API::KGPlayer kgPlayer;
#import <KakaoGame/KakaoGame.h>
 
// Querying KakaoTalk Game Friend List
kgPlayer.loadFriendPlayers(result, players); if (result.isSuccess()) {     

 [KGPlayer loadFriendPlayersWithCompletionHandler:^(NSError *error, NSArray *players) {
    if (IS_SUCCESS(error) == YES)
    {
        // Query of KakaoTalk game friend list successful
    for (KakaoGame::Data::
        for(KGPlayer *player 
:
in players)
        {
        KakaoGame::Data::KGKakaoProfile
            KGKakaoProfile *kakaoProfile = (KGKakaoProfile *)player.
kakaoProfile
idpProfile; // Used for 
게임
sending 
메시지
a 
전송시
game 
사용
message.
        }
    }
}
    else
else 
    {
    
        // Query of KakaoTalk game friend list failed
    }
}];

Windows AsyncSync

코드 블럭
#include "KakaoGameLib.h"
 
KakaoGame::Data::KGResult result;
std::vector<KakaoGame::Data::KGPlayer> players;
KakaoGame::API::KGPlayer kgPlayer;
 
// Querying KakaoTalk Game Friend List
kgPlayer.loadFriendPlayers
([this]
(
KakaoGame::Data::KGResult
result, 
std::vector<KakaoGame::Data::KGPlayer> players) {     if 
players);
if (result.isSuccess()) {
        
    // Query of KakaoTalk game friend list successful
        for 
    for (KakaoGame::Data::KGPlayer player : players) {
            KakaoGame
        KakaoGame::Data::KGKakaoProfile kakaoProfile = player.kakaoProfile; // 게임 메시지 전송시 사용.
        
    }
    
}
    else 
else {
        
    // Query of KakaoTalk game friend list failed
    
}
});

23.1.3. Sending a KakaoTalk Game Message

This section shows an example of KakaoTalk game message sending.  (Guide : 20. Kakaotalk Message Template V2 )

If you want to receive certain parameters when entering the game by touching the received message, you can set and use the exec parm in the message template.

When you receive the message with KakaoTalk and touch the link to the app, the app is executed and the exec param is passed.

You can use this value to start a specific stage or pay a predefined item. The exec parm can only use game messages.

 

Unity Example

코드 블럭using Kakaogame.SDK; KGKakaoProfile

Windows Async

코드 블럭
#include "KakaoGameLib.h"
 
KakaoGame::API::KGPlayer kgPlayer;
 
// Querying KakaoTalk Game Friend List
kgPlayer.loadFriendPlayers([this](KakaoGame::Data::KGResult result, std::vector<KakaoGame::Data::KGPlayer> players) {
    if (result.isSuccess()) {
        // Query of KakaoTalk game friend list successful
        for (KakaoGame::Data::KGPlayer player : players) {
            KakaoGame::Data::KGKakaoProfile kakaoProfile = player.kakaoProfile; // 게임 메시지 전송시 사용.
        }
    }
    else {
        // Query of KakaoTalk game friend list failed
    }
});

Unreal

코드 블럭
#include "KakaoGame.h"
  
// Querying KakaoTalk Game Friend List
FKGPlayer::LoadFriendPlayers(FKGResultWithPlayersCallback::CreateLambda([=](FKGResult result, TArray<FKGPlayer> players) {
  if (result.IsSuccess())
  {
    // Query of KakaoTalk game friend list successful
    for (FKGPlayer player : players)
    {
      FKGIdpProfile idpProfile = player.GetIdpProfile();
      FKGKakaoProfile *kakaoProfile = (FKGKakaoProfile*)&idpProfile;
    }
  }
  else
  {
    // Query of KakaoTalk game friend list failed
  }
}));

23.1.3. Sending a KakaoTalk Game Message

This section shows an example of KakaoTalk game message sending.  (Guide : 20. Kakaotalk Message Template V2 )

If you want to receive certain parameters when entering the game by touching the received message, you can set and use the exec parm in the message template.

When you receive the message with KakaoTalk and touch the link to the app, the app is executed and the exec param is passed.

You can use this value to start a specific stage or pay a predefined item. The exec parm can only use game messages.

 

Unity Example

코드 블럭
using Kakaogame.SDK;
KGKakaoProfile kakaoProfile; // Kakaotalk profile(KGKakaoProfile Object)
  
// Check if the user allows to receive a game message
if (kakaoProfile.isAllowedMessage == false)
{
    // The user doesn't allow to receive a game message. Don't send the message.
    return;
}
string templateId = "4101";
Dictionary<string, object> argumentDic = new Dictionary<string, object>() {
    {"nickname", "kakao_nickname"}
};
KGKakaoTalkMessage.SendNewGameMessage(
    kakaoProfile,
    templateId,
    argumentDic,
    (result) => {
        if (result.isSuccess) {
            // kakaoTalk game message sent successfully.
        }
        else if (result.code == KGResultCode.MessageSettingDisabled) {
            // If the recipient has opted-out of the message.
        }
        else if (result.code == KGResultCode.ExceedDailyUsage) {
            // Occurs when there is a day's quota (regardless of recipient) that one person can send for a particular app.
        }
        else if (result.code == KGResultCode.ExceedMonthlyUsage) {
            // Occurs when one month exceeds a month's quota that a specific person can send to a particular app.
        }
        else {
            // KakaoTalk game message sent fail.
        }
    });

Android Example

코드 블럭
// [TODO] Get my Kakao profile information from my Friends list
KGKakaoProfile kakaoProfile;
  
// Check if the user allows to receive a game message
if (kakaoProfile.isAllowedMessage() == false) {
    // The user doesn't allow to receive a game message. Don't send the message.
    return;
}
// [TODO] Set game message template ID
String templateId;
// [TODO] Add required arguments
Map<String, String> args = new LinkedHashMap<String, String>();
String nickname = ((KGKakaoProfile)KGLocalPlayer.getCurrentPlayer().getIdpProfile()).getNickname();
args.put("${sender_name}", nickname);
  
// Send a Kakaotalk game message
KGKakaoTalkMessage.sendNewGameMessage(kakaoProfile, templateId, args, new KGResultCallback<Boolean>() {
@Override
public void onResult(KGResult<Boolean> result) {
  if (result.isSuccess()) {
   // kakaoTalk game message sent successfully.
  } else {
   // KakaoTalk game message sent fail
   if (result.getCode() == KGResult.KGResultCode.MESSAGE_SETTING_DISABLE) {
    // If the recipient has opted-out of the message.
   } else if (result.getCode() == KGResult.KGResultCode.EXCEED_DAILY_USAGE) {
    // Occurs when there is a day's quota (regardless of recipient) that one person can send for a particular app.
   } else if (result.getCode() == KGResult.KGResultCode.EXCEED_MONTHLY_USAGE) {
    // Occurs when one month exceeds a month's quota that a specific person can send to a particular app.
   } else {
    // etc
   }
  }
}
});

iOS Example

코드 블럭
#import <KakaoGame/KakaoGame.h>
// [TODO] Get my Kakao profile information from my Friends list
KGKakaoProfile *kakaoProfile; // Kakaotalk profile
(KGKakaoProfile Object)   
(KGKakaoProfile Object)
  
if (kakaoProfile.isAllowedMessage == NO)
{
    // 
Check
The 
if
user 
the
doesn't 
user
allow 
allows
to receive Send a game message
if (kakaoProfile.isAllowedMessage == false) {     // The user doesn't allow to receive
. Don't send the message.
    return;
}
// [TODO] Set game message template ID
NSString *templateId = @"4101";
// [TODO] Add required arguments
NSDictionary* argumentDic = @{@"msg":@"This is a game message.
Don't send the message.     return; } string templateId = "4101"; Dictionary<string, object> argumentDic = new Dictionary<string, object>() {     {"nickname", "kakao_nickname"} }; KGKakaoTalkMessage.SendNewGameMessage(     kakaoProfile,     templateId,     argumentDic,     (result) => {         if (result.isSuccess) {             
", @"iphoneMarketParam":@"test", @"iphoneExecParam":@"test", @"sender_name" : @"iOSTester"};
  
// Send a Kakaotalk game message
[KGKakaoTalkMessage sendNewGameMessageWithKakaoProfile:kakaoProfile
                                            templateId:templateId
                                           argumentDic:argumentDic
                                     completionHandler:^(NSError *error) {
    if (IS_SUCCESS(error) == YES)
    {
        // kakaoTalk game message sent successfully.
        }         else if (result
    }
    else
    {
        // KakaoTalk game message sent fail
        if (error.code == 
KGResultCode.MessageSettingDisabled
KGErrorMessageSettingDisabled)
        {
            // If the recipient has opted-out of the message.
        }
        else if (
result
error.code == 
KGResultCode.ExceedDailyUsage
KGErrorExceedDailyUsage)
        {
            // Occurs when there is a day's quota (regardless of recipient) that one person can send for a particular app.
        }
        else if (
result
error.code == 
KGResultCode.ExceedMonthlyUsage
KGErrorExceedMonthlyUsage)
        {
            // Occurs when one month exceeds a month's quota that a specific person can send to a particular app.
        }
        else 
        else
        {
            // 
KakaoTalk game message sent fail.
etc
        }
    }
}
)
];

Android ExampleWindows Sync

코드 블럭
#include "KakaoGameLib.h"
 
// [TODO] 
Get
Bring 
my
your 
Kakao
own profile 
information from my Friends list KGKakaoProfile kakaoProfile;    // Check if the user allows to receive a game message if (kakaoProfile.isAllowedMessage() == false
object
KakaoGame::Data::KGLocalPlayer localPlayer;
 
// [TODO] Get my Kakao profile information from my Friends list
KakaoGame::Data::KGKakaoProfile kakaoProfile;
  
if (false == kakaoProfile.allowedMessage) {
    // The user doesn't allow to receive Send a game message. Don't send the message.
    return;
}
  
// [TODO] Set game message template ID
String
std::wtring templateId;
// [TODO] Add required arguments
Map<String
std::map<std::wstring, 
String> args = new LinkedHashMap<String, String>(); String nickname = ((KGKakaoProfile)KGLocalPlayer.getCurrentPlayer().getIdpProfile()).getNickname(); args.put
std::wstring> arguments;
arguments.insert(std::pair<std::wstring, std::wstring>(TEXT("${sender_name}"), localPlayer.kakaoProfile.nickname));
 
KakaoGame::Data::KGResult result;
  

KakaoGame::API::KGKakaoTalkMessage kgKakaoTalkMessage;
 
// Send a Kakaotalk game message
KGKakaoTalkMessage
kgKakaoTalkMessage.sendNewGameMessage(kakaoProfile, templateId, 
args, new KGResultCallback<Boolean>() { @Override public void onResult(KGResult<Boolean>
arguments, result);
{   if 
if (result.isSuccess()) {
   
    // kakaoTalk game message sent successfully.
  
}
 else 

else
{
   
    // KakaoTalk game message sent fail
   if 
    if (result.
getCode()
code == 
KGResult.KGResultCode.MESSAGE_SETTING_DISABLE
KakaoGame::Data::KGResultCode::MessageSettingDisabled) {
    
        // If the recipient has opted-out of the message.
   
    } else if (result.
getCode()
code == 
KGResult.KGResultCode.EXCEED_DAILY_USAGE
KakaoGame::Data::KGResultCode::ExceedDailyUsage) {
    
        // Occurs when there is a day's quota (regardless of recipient) that one person can send for a particular app.
   
    } else if (result.
getCode()
code == 
KGResult.KGResultCode.EXCEED_MONTHLY_USAGE
KakaoGame::Data::KGResultCode::ExceedMonthlyUsage) {
    
        // Occurs when one month exceeds a month's quota that a specific person can send to a particular app.
   
    } else {
    
        // etc
   
    }
  } } });

iOS Example

코드 블럭#import <KakaoGame/KakaoGame.h>
}

Windows Async

코드 블럭
#include "KakaoGameLib.h"
 
// [TODO] Bring your own profile object
KakaoGame::Data::KGLocalPlayer localPlayer;
 
// [TODO] Get my Kakao profile information from my Friends list
KakaoGame::Data::KGKakaoProfile 
*
kakaoProfile;
 //

Kakaotalk profile(KGKakaoProfile Object)
  
if (
kakaoProfile.isAllowedMessage
false == 
NO
kakaoProfile.allowedMessage) {
    // The user doesn't allow to receive Send a game message. Don't send the message.
    return;
}
  
// [TODO] Set game message template ID
NSString
std::wtring 
*
templateId
= @"4101"
;
// [TODO] Add required arguments
NSDictionary* argumentDic = @{@"msg":@"This is a game message.", @"iphoneMarketParam":@"test", @"iphoneExecParam":@"test", @"sender_name" : @"iOSTester"};   
std::map<std::wstring, std::wstring> arguments;
arguments.insert(std::pair<std::wstring, std::wstring>(TEXT("${sender_name}"), localPlayer.kakaoProfile.nickname));
  
KakaoGame::API::KGKakaoTalkMessage kgKakaoTalkMessage;
 
// Send a Kakaotalk game message
[KGKakaoTalkMessage sendNewGameMessageWithKakaoProfile:kakaoProfile                                             templateId:templateId                                            argumentDic:argumentDic                                      completionHandler:^(NSError *error
kgKakaoTalkMessage.sendNewGameMessage(kakaoProfile, templateId, arguments, [this](KakaoGame::Data::KGResult result) {
    if (
IS_SUCCESS(error) == YES
result.isSuccess()) 
    
{
        // kakaoTalk game message sent successfully.
    }
    else     
    else {
        // KakaoTalk game message sent fail
        if (
error
result.code == 
KGErrorMessageSettingDisabled
KakaoGame::Data::KGResultCode::MessageSettingDisabled) 
        
{
            // If the recipient has opted-out of the message.
        }
        else if 
 else if (
error
result.code == 
KGErrorExceedDailyUsage
KakaoGame::Data::KGResultCode::ExceedDailyUsage) 
        
{
            // Occurs when there is a day's quota (regardless of recipient) that one person can send for a particular app.
        }
        else if 
 else if (
error
result.code == 
KGErrorExceedMonthlyUsage
KakaoGame::Data::KGResultCode::ExceedMonthlyUsage) 
        
{
            // Occurs when one month exceeds a month's quota that a specific person can send to a particular app.
        }         else

        } else {
            // etc
        }
    }
}
]
);

Windows SyncUnreal

코드 블럭
#include "
KakaoGameLib
KakaoGame.h"
  // [TODO] Bring your own profile object KakaoGame::Data::KGLocalPlayer localPlayer;   // [TODO] Get my Kakao profile information from my Friends list KakaoGame::Data::KGKakaoProfile kakaoProfile;    if (false == kakaoProfile.allowedMessage) {     // The user doesn't allow to receive Send a game message. Don't send the message.     return; }    // [TODO] Set game message template ID std::wtring templateId; // [TODO] Add required arguments std::map<std::wstring, std::wstring> arguments; arguments.insert(std::pair<std::wstring, std::wstring>(TEXT("${sender_name}"), localPlayer.kakaoProfile.nickname));   KakaoGame::Data::KGResult result; KakaoGame::API::KGKakaoTalkMessage kgKakaoTalkMessage;   // Send a Kakaotalk game message kgKakaoTalkMessage.sendNewGameMessage(kakaoProfile, templateId, arguments, result); if (result.isSuccess()) {     // kakaoTalk game message sent successfully. } else

  
// [TODO] Get my Kakao profile information from my Friends list
FKGKakaoProfile kakaoProfile; // Kakao Profile(FKGKakaoProfile Object)
   
// Check if the user allows to receive a game message
if (kakaoProfile.IsAllowedMessage() == false)
{
  // The user doesn't allow to receive a game message. Don't send the message.
  return;
}
 
FString templateId = TEXT("4101");
 
TMap<FString, FString> argumentMap;
argumentMap.Add(TEXT("nickname"), TEXT("kakao_nickname"));
 
FKGKakaoTalkMessage::SendNewGameMessage(kakaoProfile, templateId, argumentMap, FKGResultDelegate::CreateLambda([=](FKGResult result) {
  if (result.IsSuccess())
  {
    // kakaoTalk game message sent successfully.
  }
  else if (result.GetCode() == FKGResultCode::MessageSettingDisabled)
  {
    // If the recipient has opted-out of the message.
  }
  else if (result.GetCode() == FKGResultCode::ExceedDailyUsage)
  {
    // Occurs when there is a day's quota (regardless of recipient) that one person can send for a particular app.
  }
  else if (result.GetCode() == FKGResultCode::ExceedMonthlyUsage)
  {
    // Occurs when one month exceeds a month's quota that a specific person can send to a particular app.
  }
  else
  {
    // KakaoTalk game message sent fail
    if (result.code == KakaoGame::Data::KGResultCode::MessageSettingDisabled) {         // If the recipient has opted-out of the message.     } else if (result.code == KakaoGame::Data::KGResultCode::ExceedDailyUsage) {         // Occurs when there is a day's quota (regardless of recipient) that one person can send for a particular app.     } else if (result.code == KakaoGame::Data::KGResultCode::ExceedMonthlyUsage) {         // Occurs when one month exceeds a month's quota that a specific person can send to a particular app.     } else {         // etc     } }

Windows Async

코드 블럭#include "KakaoGameLib.h"   // [TODO] Bring your own profile object KakaoGame::Data::KGLocalPlayer localPlayer;  
.
  }
}));

23.1.4. Sending a KakaoTalk game image message

This is an example of sending a KakaoTalk game image message. (Guide :20. Kakaotalk Message Template V2 )

정보

[Android] Using a dangerous permission feature

If you want to use this feature, you need to add the READ_EXTERNAL_STORAGE permission to Android Manifest.

Android 6.0+ games may use this feature after the user's permission is obtained, using the guide on the notification of individual rights and right request.

Unity Example

코드 블럭
using Kakaogame.SDK;
KGKakaoProfile kakaoProfile; // Kakaotalk profile(KGKakaoProfile Object)
  
// Check if the user allows to receive a game message
if (kakaoProfile.isAllowedMessage == false)
{
    // The user doesn't allow to receive a game message. Don't send the message.
    return;
}
// [TODO] 
Get
Set 
my
image 
Kakao
file
profile information from my Friends list KakaoGame::Data::KGKakaoProfile kakaoProfile;    if (false == kakaoProfile.allowedMessage) {     // The user doesn't allow to receive Send a game message. Don't send the message.     return; }    // [TODO] Set game message template ID std::wtring templateId; // [TODO] Add required arguments std::map<std::wstring, std::wstring> arguments; arguments.insert(std::pair<std::wstring, std::wstring>(TEXT(
Texture2D file;
// Upload an image to get the image url
KGKakaoTalk.UploadGameImage(file, (result, imageUrl) => {
    if (result.isSuccess)
    {
        // Pass in the key specified in the message template
        string templateId = "4101";
        string nickname = ((KGKakaoProfile)KGLocalPlayer.currentPlayer.idpProfile).nickname;
        Dictionary<string, object> argumentDic = new Dictionary<string, object>() {
            {"${sender_name}"
)
, 
localPlayer.kakaoProfile.nickname));    KakaoGame::API::KGKakaoTalkMessage kgKakaoTalkMessage;   // Send a Kakaotalk game message kgKakaoTalkMessage.sendNewGameMessage
nickname}
            {"${first_image}", imageUrl}
        };
    
        KGKakaoTalkMessage.SendNewGameMessage(kakaoProfile, templateId, 
arguments
argumentDic, 
[this]
(
KakaoGame::Data::KGResult
result) => {
    if 
            if (result.isSuccess
()
)
            {
        
                // kakaoTalk game message sent successfully.
    
            }
    else {         // KakaoTalk game message sent fail         if 
            else if (result.code == 
KakaoGame::Data::KGResultCode::
KGResultCode.MessageSettingDisabled)
            {
            
                // If the recipient has opted-out of the message.
        
            }
 else if 

            else if (result.code == 
KakaoGame::Data::KGResultCode::
KGResultCode.ExceedDailyUsage)
            {
            
                // Occurs when there is a day's quota (regardless of recipient) that one person can send for a particular app.
        
            }
 else if 

            else if (result.code == 
KakaoGame::Data::KGResultCode::
KGResultCode.ExceedMonthlyUsage)
            {
            
                // Occurs when one month exceeds a month's quota that a specific person can send to a particular app.
        } else {             
            }
            else if (result.code == KGResultCode.NotKakaoTalkUser)
            {
                // 
etc         }     } });

23.1.4. Sending a KakaoTalk game image message

This is an example of sending a KakaoTalk game image message. (Guide :20. Kakaotalk Message Template V2 )

정보

[Android] Using a dangerous permission feature

If you want to use this feature, you need to add the READ_EXTERNAL_STORAGE permission to Android Manifest.

Android 6.0+ games may use this feature after the user's permission is obtained, using the guide on the notification of individual rights and right request.

Unity Example

코드 블럭
using Kakaogame.SDK;
KGKakaoProfile kakaoProfile; // Kakaotalk profile(KGKakaoProfile Object)
  
// Check if the user allows to receive a game messageThe 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 cacao story.
            }
            else
            {
                // etc
            }
        });
    }
    else
    {
        // Image upload failed
    }
});

Android Example

코드 블럭
// [TODO] Get my Kakao profile information from my Invite Friends list
KGKakaoProfile kakaoProfile;
  
if (kakaoProfile.isAllowedMessage ==
 false
 NO)
{
    // The user doesn't allow to receive Send a game message. Don't send the message.
    return;
}
// [TODO] Set game message template ID
String templateId;
  
// [TODO] Set image file
File file;
// Upload an image
file Texture2D file; // Upload an image to get the image url KGKakaoTalk.UploadGameImage(file, (result, imageUrl) => {     if (result.isSuccess)     {         // Pass in the key specified in the message template         string templateId = "4101";         string nickname
 to get the image url
KGKakaoTalk.uploadGameImage(file, new KGResultCallback<String>() {
    @Override
    public void onResult(KGResult<String> result) {
        if (result.isSuccess()) {
            // The url of the uploaded image
            imageUrl = result.getContent();
        } else {
            // Image upload failed
        }
    }
});
  
// [TODO] Add required arguments to invitation message
Map<String, String> args = new LinkedHashMap<String, String>();
String nickname = ((KGKakaoProfile)KGLocalPlayer.
currentPlayer.idpProfile
getCurrentPlayer().getIdpProfile()).
nickname
getNickname();
        Dictionary<string, object> argumentDic = new Dictionary<string, object>() {             {"${sender_name}", nickname}             {"${first_image}", imageUrl}         };              KGKakaoTalkMessage.SendNewGameMessage
args.put("${sender_name}", nickname);
args.put("${first_image}", imageUrl); // Pass in the key specified in the message template
// Send a Kakaotalk game message
KGKakaoTalkMessage.sendNewGameMessage(kakaoProfile, templateId, 
argumentDic
args, new KGResultCallback<Boolean>() {
@Override
public void onResult(KGResult<Boolean> result)
=>
 {
            if 
  if (result.isSuccess()) 
            
{
                
   // kakaoTalk game message sent successfully.
            }             else if (result.code == KGResultCode.MessageSettingDisabled)             {                 // If the recipient has opted-out of the message.             }             else if (result.code
  } else {
   // KakaoTalk game message sent fail
   if (result.getCode() == KGResult.KGResultCode.
ExceedDailyUsage
MESSAGE_SETTING_DISABLE) 
            
{
                
    // 
Occurs
If 
when
the 
there
recipient 
is a day's quota (regardless
has opted-out of 
recipient) that one person can send for a particular app.             }             else if (result.code
the message.
   } else if (result.getCode() == KGResult.KGResultCode.
ExceedMonthlyUsage
EXCEED_DAILY_USAGE) 
            
{
                
    // Occurs when 
one month
there 
exceeds
is a 
month
day's quota (regardless of recipient) that 
a specific
one person can send 
to
for a particular app.
            
   }
            else if 
 else if (result.
code
getCode() == KGResult.KGResultCode.
NotKakaoTalkUser
EXCEED_MONTHLY_USAGE) 
            
{
                
    // 
The
Occurs 
logged-in
when 
user
one 
is
month 
not
exceeds a 
"Kakao Talk" user. If you are not
month's quota that a 
KakaoTalk
specific 
user
person 
with
can 
the account of a user who has just registered
send to a 
cacao
particular 
story
app.
            }             else             
   } else {
                
    // etc
            
   }
        });     }     else     {         // Image upload failed     
  }
}
});

Android iOS Example

코드 블럭
#import <KakaoGame/KakaoGame.h>
// [TODO] Get my Kakao profile information from my Invite Friends list
KGKakaoProfile *kakaoProfile; // Kakaotalk profile(KGKakaoProfile Object)
  
if (kakaoProfile.isAllowedMessage == NO)
{
    // The user doesn't allow to receive Send
a game message. Don't send the message.     return; } // [TODO] Set
 a game message. Don't 
template
send 
ID
the 
String
message.
templateId
    return;
  
}
// [TODO] Set image file
File
UIImage* file;
// Upload an image to get the image url
[KGKakaoTalk
.
 uploadGameImage
(file, new KGResultCallback<String>() {     @Override     public void onResult(KGResult<String> result
:file completionHandler:^(NSError *error, NSString *imageUrl) {
        if (result.isSuccess()) {             // The url of the uploaded image             imageUrl = result.getContent();         } else {             // Image upload failed         }     } });    // [TODO] Add required arguments to invitation message Map<String, String> args = new LinkedHashMap<String, String>(); String nickname = ((KGKakaoProfile)KGLocalPlayer.getCurrentPlayer().getIdpProfile()).getNickname(); args.put("${sender_name}", nickname); args.put("${first_image}", imageUrl); // Pass in the key specified in the message template // Send a Kakaotalk game message KGKakaoTalkMessage.sendNewGameMessage(kakaoProfile, templateId, args, new KGResultCallback<Boolean>() { @Override public void onResult(KGResult<Boolean> result) {   if (result.isSuccess()) {    // kakaoTalk game message sent successfully.   } else {    // KakaoTalk game message sent fail    if (result.getCode() == KGResult.KGResultCode.MESSAGE_SETTING_DISABLE) {     // If the recipient has opted-out of the message.    } else if (result.getCode() == KGResult.KGResultCode.EXCEED_DAILY_USAGE) {     // Occurs when there is a day's quota (regardless of recipient) that one person can send for a particular app.    } else if (result.getCode() == KGResult.KGResultCode.EXCEED_MONTHLY_USAGE) {     // Occurs when one month exceeds a month's quota that a specific person can send to a particular app.    } else {     // etc    }   } } });

iOS Example

코드 블럭
#import <KakaoGame/KakaoGame.h>    if (IS_SUCCESS(error) == YES)
    {
        // Pass in the key specified in the message template
        NSString* templateId = @"4101";
        NString* nickname = kakaoProfile.nickname;
        NSDictionary* argumentDic = @{@"${sender_name}":nickname, @"${first_image}":imageUrl};
   
        [KGKakaoTalkMessage sendNewGameMessageWithKakaoProfile:kakaoProfile templateId:templateId argumentDic:argumentDic completionHandler:^(NSError* error) {
            if (IS_SUCCESS(error) == YES)
            {
                // kakaoTalk game message sent successfully.
            }
            else
            {
                // 카카오톡 게임 메시지 보내기 실패
                if (error.code == KGErrorMessageSettingDisabled)
                {
                    // If the recipient has opted-out of the message.
                }
                else if (error.code == KGErrorExceedDailyUsage)
                {
                    // Occurs when there is a day's quota (regardless of recipient) that one person can send for a particular app.
                }
                else if (error.code == KGErrorExceedMonthlyUsage)
                {
                    // Occurs when one month exceeds a month's quota that a specific person can send to a particular app.
                }
                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 cacao story.
                }
                else
                {
                    // etc
                }
            }
        }];
    }
    else
    {
        // Image upload failed
    }
}];

Windows Sync

코드 블럭
#include "KakaoGameLib.h"
 
// [TODO] Bring your own profile object
KakaoGame::Data::KGLocalPlayer localPlayer;
 
// [TODO] Get my Kakao profile information from my 
Invite
Friends list
KakaoGame::Data::KGKakaoProfile 
*
kakaoProfile;
 // Kakaotalk profile(KGKakaoProfile

Object)
  
if (
kakaoProfile.isAllowedMessage
false == 
NO
kakaoProfile.allowedMessage) {
    // The user doesn't allow to receive Send a game message. Don't send the message.
    return;
}
  
// [TODO] Set image file
UIImage* file; // Upload an image to get the image url [KGKakaoTalk uploadGameImage:file completionHandler:^(NSError *error, NSString *imageUrl) {     if (IS_SUCCESS(error) == YES)     {         //
std::wtring image;
KakaoGame::Data::KGResult result;
std::wstring imageUrl;
KakaoGame::API::KGKakaoTalk kgKakaoTalk;
 
kgKakaoTalk.uploadGameImage(image, result, imageUrl);
  
if (false == result.isSuccess()) {
    // Image upload failed
    return;
}
  
// [TODO] Pass in the key specified in the message template
        NSString*
std::wtring templateId;
= @"4101";         NString* nickname = kakaoProfile.nickname;         NSDictionary* argumentDic = @{@
// [TODO] Add required arguments
std::map<std::wstring, std::wstring> arguments;
arguments.insert(std::pair<std::wstring, std::wstring>(TEXT("${sender_name}"
:nickname, @
), localPlayer.kakaoProfile.nickname));
arguments.insert(std::pair<std::wstring, std::wstring>(TEXT("${first_image}"
:imageUrl};             [KGKakaoTalkMessage sendNewGameMessageWithKakaoProfile:kakaoProfile templateId:templateId argumentDic:argumentDic completionHandler:^(NSError* error) {             if (IS_SUCCESS(error) == YES)             {                 
), imageUrl));
 
KakaoGame::Data::KGResult result;
KakaoGame::API::KGKakaoTalkMessage kgKakaoTalkMessage;
 
// Send a Kakaotalk game message
kgKakaoTalkMessage.sendNewGameMessage(kakaoProfile, templateId, arguments, result);
if (result.isSuccess()) {
    // kakaoTalk game message sent successfully.
            
}
            else             
else {
                
    // 카카오톡 게임 메시지 보내기 실패
                if 
    if (
error
result.code == 
KGErrorMessageSettingDisabled
KakaoGame::Data::KGResultCode::MessageSettingDisabled) 
                
{
                    
        // If the recipient has opted-out of the message.
                
    }
                else if 
 else if (
error
result.code == 
KGErrorExceedDailyUsage
KakaoGame::Data::KGResultCode::ExceedDailyUsage) 
                
{
                    
        // Occurs when there is a day's quota (regardless of recipient) that one person can send for a particular app.
                
    }
                else if 
 else if (
error
result.code == 
KGErrorExceedMonthlyUsage
KakaoGame::Data::KGResultCode::ExceedMonthlyUsage) 
                
{
                    
        // Occurs when one month exceeds a month's quota that a specific person can send to a particular app.
                
    }
                else if 
 else if (
error
result.code == 
KGErrorNotKakaoTalkUser
KakaoGame::Data::KGResultCode::NotKakaoTalkUser) 
                
{
                    
        // 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 cacao story.
                }                 else                 
    } else {
                    
        // etc
                }             }         }];
    }
    else     {         // Image

upload failed     
}
}];

Windows SyncAsync

코드 블럭
#include "KakaoGameLib.h"
 
// [TODO] Bring your own profile object
KakaoGame::Data::KGLocalPlayer localPlayer;
 
// [TODO] Get my Kakao profile information from my Friends list
KakaoGame::Data::KGKakaoProfile kakaoProfile;
  
if (false == kakaoProfile.allowedMessage) {
    // The user doesn't allow to receive Send a game message. Don't send the message.
    return;
}
  
// [TODO] Set image file
std::wtring image;
KakaoGame::Data::KGResult result;
std::wstring imageUrl;
KakaoGame::API::KGKakaoTalk kgKakaoTalk;
 
kgKakaoTalk.uploadGameImage(image, result, imageUrl);
  
if (false == result.isSuccess()) {
    // Image upload failed
    return;
}
  
// [TODO] Pass in the key specified in the message template
std::wtring templateId;
// [TODO] Add required arguments
std::map<std::wstring, std::wstring> arguments;
arguments.insert(std::pair<std::wstring, std::wstring>(TEXT("${sender_name}"), localPlayer.kakaoProfile.nickname));
arguments.insert(std::pair<std::wstring, std::wstring>(TEXT("${first_image}"), imageUrl));
  KakaoGame::Data::KGResult result;
  
KakaoGame::API::KGKakaoTalkMessage kgKakaoTalkMessage;
 
// Send a Kakaotalk game message
kgKakaoTalkMessage.sendNewGameMessage(kakaoProfile, templateId, arguments, [this](KakaoGame::Data::KGResult result)
;
 {
if 
    if (result.isSuccess()) {
    
        // kakaoTalk game message sent successfully.
    }
else 
    else {
    
        // 카카오톡 게임 메시지 보내기 실패
    if 
        if (result.code == KakaoGame::Data::KGResultCode::MessageSettingDisabled) {
        
            // If the recipient has opted-out of the message.
    
        } else if (result.code == KakaoGame::Data::KGResultCode::ExceedDailyUsage) {
        
            // Occurs when there is a day's quota (regardless of recipient) that one person can send for a particular app.
    
        } else if (result.code == KakaoGame::Data::KGResultCode::ExceedMonthlyUsage) {
        
            // Occurs when one month exceeds a month's quota that a specific person can send to a particular app.
    
        } else if (result.code == KakaoGame::Data::KGResultCode::NotKakaoTalkUser) {
        
            // 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 cacao story.     } else {         // etc     } }

Windows Async

코드 블럭
#include "KakaoGameLib.h"
 
// [TODO] Bring your own profile object
KakaoGame::Data::KGLocalPlayer localPlayer;
 
// [TODO] Get my Kakao profile information from my Friends list
KakaoGame::Data::KGKakaoProfile kakaoProfile;
  
if (false == kakaoProfile.allowedMessage) {
    // The user doesn't allow to receive Send a game message. Don't send the message.
    return;
}
   If you are not a KakaoTalk user with the account of a user who has just registered a cacao story.
        } else {
            // etc
        }
    }
});

Unreal

코드 블럭
#include "KakaoGame.h"

FKGKakaoProfile kakaoProfile;

// [TODO] Set image file
std::wtring image
FString imagePath;
KakaoGame
FKGKakaoTalk::
Data
UploadGameImage(imagePath, FKGResultWithImageUrlPathDelegate::
KGResult
CreateLambda([=](FKGResult result
; std::wstring
, FString imageUrl
; KakaoGame::API::KGKakaoTalk kgKakaoTalk;   kgKakaoTalk.uploadGameImage(image, result, imageUrl);    if (false == result.isSuccess()) {     
) {
  if (result.IsSuccess())
  {
    // Image upload 
failed
success
    return;
 
}
 
  
 
//
 
[TODO]
FString 
Pass
templateId 
in the key specified in the message template std::wtring templateId; // [TODO] Add required arguments std::map<std::wstring, std::wstring> arguments; arguments.insert(std::pair<std::wstring, std::wstring>
= TEXT("4101");

    // Send Message
    TMap<FString, FString> argumentMap;
    argumentMap.Add(TEXT("${sender_name}"), 
localPlayer.kakaoProfile.nickname
TEXT("nickname"));
arguments.insert(std::pair<std::wstring, std::wstring>
    argumentMap.Add(TEXT("${first_image}"), TEXT("imageUrl"))
;    KakaoGame::API::KGKakaoTalkMessage kgKakaoTalkMessage
;
 

//
 
Send
 
a
 
Kakaotalk game message kgKakaoTalkMessage.sendNewGameMessage
 FKGKakaoTalkMessage::SendNewGameMessage(kakaoProfile, templateId, 
arguments
argumentMap, FKGResultDelegate::CreateLambda([
this](KakaoGame::Data::KGResult result) {     if (result.isSuccess()) {         
=](FKGResult result) {
      if (result.IsSuccess())
      {
        // kakaoTalk game message sent successfully.
      
    
}
    else {
  
        //
 
카카오톡
 
게임
 
메시지
 
보내기
else 
실패
if 
        if 
(result.
code
GetCode() == 
KakaoGame::Data::KGResultCode
FKGResultCode::MessageSettingDisabled)
      {
            

        // If the recipient has opted-out of the message.
     
        } else if 
 }
      else if (result.
code
GetCode() == 
KakaoGame::Data::KGResultCode
FKGResultCode::ExceedDailyUsage)
      {
            

        // Occurs when there is a day's quota (regardless of recipient) that one person can send for a particular app.
     
        } else if 
 }
      else if (result.
code
GetCode() == 
KakaoGame::Data::KGResultCode
FKGResultCode::ExceedMonthlyUsage)
      {
            

        // Occurs when one month exceeds a month's quota that a specific person can send
to a particular app.         } else if (result.code
 to a particular app.
      }
      else if (result.GetCode() == 
KakaoGame
FKGResultCode::
Data::KGResultCode::
NotKakaoTalkUser)
      {
            

        // The logged-in user is not a "Kakao Talk" user.
If
 
you
 
are
 
not
 
a
 
KakaoTalk
 
user
}
with
 
the
 
account
 
of
 
a
 
user
 
who
else
has
 
just
 
registered
 
a
 
cacao
 
story.
 
        } else {             
{
        // etc
        }     

      }
    }));
  }
}));