...
코드 블럭 |
---|
#import <KakaoGame/KakaoGame.h>
// [TODO] Get my Kakao profile information from my Invite Friends list
KGKakaoProfile *kakaoProfile; // Kakaotalk profile(KGKakaoProfile Object)
// [TODO] Set invitation message template ID
NSString *templateId = @"4108";
// [TODO] Add required arguments to invitation message
NSDictionary* argumentDic = @{@"name" : @"nickname", @"iphoneMarketParam" : @"test", @"iphoneExecParam" : @"test", @"sender_name" : @"iOSTester", @"invitation_event_id" : @(29)};
// Send a Kakaotalk invitation message
[KGKakaoTalkMessage sendNewInviteMessageWithKakaoProfile:kakaoProfile
templateId:templateId
argumentDic:argumentDic
completionHandler:^(NSError *error) {
if (IS_SUCCESS(error) == YES)
{If the recipient has opted-out of the message
// Sending invitation message to KakaoTalk succeeded
}
else
{
// Failed to send Kakao Talk invitation message
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
{
// etc
}
}
}]; |
|
20.1.2. Send an game message V2 to a friend
This section shows an example of a send an game message V2 to a friend.
Unity Example
...
코드 블럭 |
---|
using Kakaogame.SDK;
KGKakaoProfile kakaoProfile; // Kakaotalk profile(KGKakaoProfile Object)
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;
// [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)
// [TODO] Set game message template ID
NSString *templateId = @"4101";
// [TODO] Add required arguments
NSDictionary* argumentDic = @{@"msg":@"This is a game message.", @"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
{
// KakaoTalk game message sent fail
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
{
// etc
}
}
}]; |
20.1.3. Send an group chat room message V2 to a friend
This section shows an example of a send an group chat room message V2 to a friend.
Unity Example
...
Unreal
코드 블럭 |
---|
#include "KakaoGame.h"
// [TODO] Get my Kakao profile information from my Invite Friends list
FKGKakaoProfile kakaoProfile;
// [TODO] Set invitation message template ID
FString templateId = TEXT("4180")
// [TODO] Add required arguments to invitation message
TMap<FString, FString> argumentDic;
argumentDic.Add(TEXT("nickname"), TEXT("tester"));
FKGKakaoTalkMessage::SendNewInviteMessage(kakaoProfile, templateId, argumentDic, FKGResultDelegate::CreateLambda([=](FKGResult result) {
if (result.IsSuccess())
{
// Sending invitation message to KakaoTalk succeeded
}
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
{
// etc
}
}
})); |
|
20.1.2. Send an game message V2 to a friend
This section shows an example of a send an game message V2 to a friend.
Unity Example
코드 블럭 |
---|
using Kakaogame.SDK;
KGKakaoProfile kakaoProfile; // Kakaotalk profile(KGKakaoProfile Object)
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;
// [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)
// [TODO] Set game message template ID
NSString *templateId = @"4101";
// [TODO] Add required arguments
NSDictionary* argumentDic = @{@"msg":@"This is a game message.", @"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
{
// KakaoTalk game message sent fail
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
{
// etc
}
}
}]; |
|
Unreal
코드 블럭 |
---|
#include "KakaoGame.h"
// [TODO] Get my Kakao profile information from my Friends list
FKGKakaoProfile kakaoProfile;
// [TODO] Set game message template ID
FString templateId = TEXT("4180")
// [TODO] Add required arguments
TMap<FString, FString> argumentDic;
argumentDic.Add(TEXT("nickname"), TEXT("tester"));
FKGKakaoTalkMessage::SendNewGameMessage(kakaoProfile, templateId, argumentDic, 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
{
// etc
}
}
})); |
|
20.1.3. Send an group chat room message V2 to a friend
This section shows an example of a send an group chat room message V2 to a friend.
Unity Example
코드 블럭 |
---|
sing Kakaogame.SDK;
KGKakaoTalkGroupChat groupChat; // Group chat room(KGKakaoTalkGroupChat object)
string templateId = "4108";
Dictionary<string, object> argumentDic = new Dictionary<string, object>();
KGKakaoTalkMessage.SendNewGroupChatMessage(
groupChat,
templateId,
argumentDic,
(result) => {
if (result.isSuccess) {
// kakaoTalk group chat 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 {
// etc
}
}); |
|
Android Example
코드 블럭 |
---|
// [TODO] Get my chat room information from my chat room list
KGKakaoTalkGroupChat groupChat
// [TODO] Set group message template ID
String templateId;
// [TODO] Add required arguments to group message
Map<String, String> args = new LinkedHashMap<String, String>();
String nickname = ((KGKakaoProfile)KGLocalPlayer.getCurrentPlayer().getIdpProfile()).getNickname();
args.put("${sender_name}", nickname);
// Send a Kakaotalk group message
KGKakaoTalkMessage.sendNewGroupChatMessage(groupChat, templateId, args, new KGResultCallback<Boolean>() {
@Override
public void onResult(KGResult<Boolean> result) {
if (result.isSuccess()) {
// kakaoTalk group chat message sent successfully.
|
|
else if else {
// kakaoTalk group chat message sent fail.
if (result. |
|
codegetCode() == KGResult.KGResultCode. |
|
MessageSettingDisabledMESSAGE_SETTING_DISABLE) {
|
|
// If the recipient has opted-out of the message.
|
|
else if codegetCode() == KGResult.KGResultCode. |
|
ExceedDailyUsage // Occurs when there is a day's quota (regardless of recipient) that one person can send for a particular app.
|
|
else if codegetCode() == KGResult.KGResultCode. |
|
ExceedMonthlyUsage // Occurs when one month exceeds a month's quota that a specific person can send to a particular app.
|
|
else Android iOS Example
|
---|
#import <KakaoGame/KakaoGame.h>
// [TODO] Get my chat room information from my chat room list
KGKakaoTalkGroupChat *groupChat |
|
[TODO]Setgroup message template ID
String templateId;room(KGKakaoTalkGroupChat object)
// [TODO] |
|
Add required arguments to Map<String, String> args = new LinkedHashMap<String, String>();
String nickname = ((KGKakaoProfile)KGLocalPlayer.getCurrentPlayer().getIdpProfile()).getNickname();
args.put("${sender_name}", nickname)template ID
NSString *templateId = @"4108";
// |
|
Send a Kakaotalk[TODO] Add required arguments to group message
|
|
KGKakaoTalkMessage.sendNewGroupChatMessage(groupChat, templateId, args, new KGResultCallback<Boolean>() {
@Override
public void onResult(KGResult<Boolean> result) {
if (result.isSuccess()) {
// kakaoTalk group chat message sent successfully.
} else {
// kakaoTalk group chat 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) {
NSDictionary *argumentDic = @{@"msg" : @"This is a group message.", @"iphoneMarketParam" : @"test", @"iphoneExecParam" : @"test", @"sender_name" : @"iOSTester"};
// Send a Kakaotalk group message
[KGKakaoTalkMessage sendNewGroupChatMessageWithGroupChat:groupChat
templateId:templateId
argumentDic:argumentDic
completionHandler:^(NSError *error) {
if (IS_SUCCESS(error) == YES)
{
// kakaoTalk group chat message sent successfully.
}
else
{
// kakaoTalk group chat message sent fail.
if (error.code == KGErrorMessageSettingDisabled)
{
// If the recipient has opted-out of the message.
}
else if (error.code == KGErrorExceedDailyUsage)
{
// Occurs when |
|
onemonth exceedsmonthday's quota (regardless of recipient) that |
|
aspecific to particular app.
} else {
// etc
}
}
}
});iOS Example
코드 블럭 |
---|
#import <KakaoGame/KakaoGame.h>
// [TODO] Get my chat room information from my chat room list
KGKakaoTalkGroupChat *groupChat; // Group chat room(KGKakaoTalkGroupChat object)
// [TODO] Set group message template ID
NSString *templateId = @"4108"; 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
{
// etc
}
}
}]; |
|
Unreal
코드 블럭 |
---|
#include "KakaoGame.h"
// [TODO] Get |
|
AddrequiredargumentstogroupmessageNSDictionary*argumentDic= @{@"msg" : @"This is aFKGKakaoTalkGroupChat groupChat;
// [TODO] Set group message |
|
.", @"iphoneMarketParam" : @"test", @"iphoneExecParam" : @"test", @"sender_name" : @"iOSTester"};
// Send a Kakaotalk group message
[KGKakaoTalkMessage sendNewGroupChatMessageWithGroupChat:groupChat
templateId:templateId
argumentDic:argumentDic
completionHandler:^(NSError *error) {
if (IS_SUCCESS(error) == YES)
{
template ID
FString templateId = TEXT("4180")
// [TODO] Add required arguments to group message
TMap<FString, FString> argumentDic;
argumentDic.Add(TEXT("nickname"), TEXT("tester"));
FKGKakaoTalkMessage::SendNewGroupChatMessage(groupChat, templateId, argumentDic, FKGResultDelegate::CreateLambda([=](FKGResult result) {
if (result.IsSuccess())
{
// kakaoTalk group chat message sent successfully.
|
|
else
// kakaoTalk group chat message sent fail.
if (error.code == KGErrorMessageSettingDisabled)
{
if (result.GetCode() == FKGResultCode::MessageSettingDisabled)
{
// If the recipient has opted-out of the message |
|
.
else if (error.code
else if (result.GetCode() == |
|
KGErrorExceedDailyUsage)
{
FKGResultCode::ExceedDailyUsage)
{
// 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)
{
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
{
]20.1.4. Send Message V2 to Guild Chat Room
...