...
코드 블럭 |
---|
#import <KakaoGame/KakaoGame.h>
// query of the ongoing invitation event list.
[KGKakaoInvitation loadEventsWithCompletionHandler:^(NSError *error, NSArray *invitationEvents) {
if (IS_SUCCESS(error) == YES)
{
// Successful invitation event list lookup
if (invitationEvents != nil)
{
for (KGKakaoEvent *invitationEvent in invitationEvents)
{
// Event ID: Required when sending an invitation message, to retrieve a list of invitees or senders.
int eventId = invitationEvent.eventId;
// Event start time
long long startTime = invitationEvent.startTime;
// Event end time
long long finishTime = invitationEvent.finishTime;
// Event Description
NSString *eventDescription = invitationEvent.eventDescription;
}
}
}
else if (error.code == KGErrorNotKakaoTalkUser)
{
// The user is not a KakaoTalk user.
}
else
{
// Fail invitation event list lookup
}
}]; |
|
Windows Sync
...
코드 블럭 |
---|
#include "KakaoGameLib.h"
KakaoGame::Data::KGResult result;
std::vector<KakaoGame::Data::KGKakaoEvent> invitationEvents;
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
// query of the ongoing invitation event list.
kgKakaoInvitation.loadEvents(result, invitationEvents)'
if (result.isSuccess()) {
// Successful invitation event list lookup
for (KakaoGame::Data::KGKakaoEvent invitationEvent : invitationEvents)
{
// Event ID: Required when sending an invitation message, to retrieve a list of invitees or senders.
int32_t eventId = invitationEvent.eventId;
// Event start time
int64_t startTime = invitationEvent.startTime;
// Event end time
int64_t finishTime = invitationEvent.finishTime;
// Event Description
std::wstring eventDescription = invitationEvent.eventDescription;
}
}
else if (result.code == KakaoGame::Data::KGResultCode::NotKakaoTalkUser)
{
// The user is not a KakaoTalk user.
}
else
{
// Fail invitation event list lookup
} |
Windows Async
...
코드 블럭 |
---|
#include "KakaoGameLib.h"
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
// query of the ongoing invitation event list.
kgKakaoInvitation.loadEvents([this](KakaoGame::Data::KGResult result, std::vector<KakaoGame::Data::KGKakaoEvent> invitationEvents) {
if (result.isSuccess()) {
// Successful invitation event list lookup
for (KakaoGame::Data::KGKakaoEvent invitationEvent : invitationEvents) {
// Event ID: Required when sending an invitation message, to retrieve a list of invitees or senders.
int32_t eventId = invitationEvent.eventId;
// Event start time
int64_t startTime = invitationEvent.startTime;
// Event end time
int64_t finishTime = invitationEvent.finishTime;
// Event Description
std::wstring eventDescription = invitationEvent.eventDescription;
}
}
else if (result.code == KakaoGame::Data::KGResultCode::NotKakaoTalkUser)
{
// The user is not a KakaoTalk user.
}
else
{
// Fail invitation event list lookup
}
}); |
Unreal
...
코드 블럭 |
---|
#include "KakaoGame.h"
// query of the ongoing invitation event list.
FKGKakaoInvitation::LoadEvents(FKGResultWithEventsDelegate::CreateLambda([=](FKGResult result, TArray<FKGKakaoEvent> events) {
if (result.IsSuccess())
{
// Successful invitation event list lookup
for (FKGKakaoEvent invitationEvent : events)
{
// Event ID: Required when sending an invitation message, to retrieve a list of invitees or senders.
int32 eventId = invitationEvent.GetEventId();
// Event start time
int64 startTime = invitationEvent.GetStartTime();
// Event end time
int64 finishTime = invitationEvent.GetFinishTime();
// Event Description
FString eventDescription = invitationEvent.GetEventDescription();
}
}
else if (result.GetCode() == FKGResultCode::NotKakaoTalkUser)
{
// The user is not a KakaoTalk user.
}
else
{
// Fail invitation event list lookup
}
})); |
21.1.2. Querying KakaoTalk Invitation Target List
This section shows an example of a query of the KakaoTalk invitation target list.
KakaoGame Platform will recommended friends who will join the game with high possibility. The number of recommended friends may less than the number of recommend limt you have set.
When sending an invitation message to KakaoTalk, you must pass the 'KakaoProfile' object received using this API as an argument.
The friend list is first listed according to the ranking given by the server on the recommend limit, and then sorted in alphabetical order.
If you want to show recommended friends in the UI, you can use the 'isRecommended' argument.
Unity 예제
...
코드 블럭 |
---|
using Kakaogame.SDK;
using Kakaogame.SDK.Kakao;
// [TODO] Set limit of recommended friends
int recommendLimit = 5; // The number of recommended friends
// int recommendLimit = 0; // Set to 0 if you want to fetch the list without recommended friends
// int recommendLimit = -1; // Set it to -1 if you want to include all of your recommended friends (the number of recommended friends is variably)
// [TODO] Set start value for querying friend list
int offset; // Start value for querying friend list
// [TODO] Set size of querying friend list
int limit; // Friend list size
// Querying KakaoTalk Invitation Target List
KGKakaoInvitation.LoadInvitableFriendProfiles(recommendLimit, offset, limit, (result, totalCount, kakaoProfiles) => {
if (result.isSuccess)
{
// Success
// Query of invitation target friend profile list successful
foreach (KGKakaoProfile kakaoProfile in kakaoProfiles)
{
// KakaoTalk nickname
string nickname = kakaoProfile.nickname;
// KakaoTalk profile thumbnail image url
string thumbnailImageUrl = kakaoProfile.thumbnailImageUrl;
// If this user is a recommended friend or not
BOOL isRecommended = kakaoProfile.isRecommended;
// KakaoTalk installation os
string talkOs = kakaoProfile.kakaoTalkOS.ToString();
// Whether your friends are allowed to get messages or not. You must not send message if it is 'false'.
bool isAllowMessage = kakaoProfile.isAllowedMessage;
}
}
else if (result.code == KGResultCode.NotKakaoTalkUser)
{
// The user is not a KakaoTalk user.
}
else
{
// Fail...
}
}); |
Android 예제
...
코드 블럭 |
---|
import com.kakaogame.KGKakaoInvitation;
import com.kakaogame.KGKakaoProfile;
import com.kakaogame.KGKakaoProfile.KGKakaoFriendsResponse;
import com.kakaogame.KGResult;
// [TODO] Set limit of recommended friends
int recommendLimit = 5; // The number of recommended friends
// int recommendLimit = 0; // Set to 0 if you want to fetch the list without recommended friends
// int recommendLimit = -1; // Set it to -1 if you want to include all of your recommended friends (the number of recommended friends is variably)
// [TODO] Set start value for querying friend list
int offset; // Start value for querying friend list
// [TODO] Set size of querying friend list
int limit; // Friend list size
// Querying KakaoTalk Invitation Target List
KGKakaoInvitation.loadInvitableFriendProfiles(recommendLimit, offset, limit, new KGResultCallback<KGKakaoFriendsResponse>() {
@Override
public void onResult(KGResult<KGKakaoFriendsResponse> result) {
if (result.isSuccess()) {
// Success
// Query of invitation target friend profile list successful
KGKakaoFriendsResponse response = result.getContent();
// Total count of friends you can invite
int totalCount = response.getTotalCount();
// Invite Friend List - list of friend profile objects to use when sending invitation messages
List<KGKakaoProfile> friendList = response.getFriendList();
for (KGKakaoProfile kakaoProfile : friendList) {
// KakaoTalk nickname
String nickname = kakaoProfile.getNickname();
// KakaoTalk profile thumbnail image url
String thumbnailImageUrl = kakaoProfile.getThumbnailImageUrl();
// If this user is a recommended friend or not
boolean isRecommended = kakaoProfile.isRecommended();
// KakaoTalk installation os
String talkOs = kakaoProfile.getTalkOs();
// Whether your friends are allowed to get messages or not. You must not send message if it is 'false'.
boolean isAllowMessage = kakaoProfile.isAllowedMessage();
}
} else if (result.getCode() == KGResult.KGResultCode.NOT_KAKAOTALK_USER) {
// The user is not a KakaoTalk user.
} else {
// Fail...
}
}
}); |
iOS 예제
...
코드 블럭 |
---|
#import <KakaoGame/KakaoGame.h>
// [TODO] Set limit of recommended friends
int recommendLimit = 5; // The number of recommended friends
// int recommendLimit = 0; // Set to 0 if you want to fetch the list without recommended friends
// int recommendLimit = -1; // Set it to -1 if you want to include all of your recommended friends (the number of recommended friends is variably)
// [TODO] Set start value for querying friend list
int offset; // Start value for querying friend list
// [TODO] Set size of querying friend list
int limit; // Friend list size
// Querying KakaoTalk Invitation Target List
[KGKakaoInvitation loadInvitableFriendProfilesWithRecommendLimit:recommendLimit offset:offset limit:limit completionHandler:^(NSError *error, int totalCount, NSArray *idpProfiles) {
if (IS_SUCCESS(error) == YES)
{
// Success
// Query of invitation target friend profile list successful
for (KGKakaoProfile *kakaoProfile in idpProfiles)
{
// KakaoTalk nickname
NSString *nickname = kakaoProfile.nickname;
// KakaoTalk profile thumbnail image url
NSString *thumbnailImageUrl = kakaoProfile.thumbnailImageUrl;
// If this user is a recommended friend or not
BOOL isRecommended = kakaoProfile.isRecommended;
// KakaoTalk installation os
NSString *talkOs = kakaoProfile.kakaoTalkOS.description;
// Whether your friends are allowed to get messages or not. You must not send message if it is 'false'.
BOOL isAllowMessage = kakaoProfile.isAllowedMessage;
}
}
else if (error.code == KGErrorNotKakaoTalkUser)
{
// The user is not a KakaoTalk user.
}
else
{
// Fail...
}
}]; |
Windows Sync
...
코드 블럭 |
---|
#include "KakaoGameLib.h"
// [TODO] Set limit of recommended friends
int32_t recommendLimit = 5; // The number of recommended friends
// int32_t recommendLimit = 0; // Set to 0 if you want to fetch the list without recommended friends
// int32_t recommendLimit = -1; // Set it to -1 if you want to include all of your recommended friends (the number of recommended friends is variably)
// [TODO] Set start value for querying friend list
int32_t offset; // Start value for querying friend list
// [TODO] Set size of querying friend list
int32_t limit; // Friend list size
KakaoGame::Data::KGResult result;
int32_t totalCount;
std::vector<KakaoGame::Data::KGKakaoProfile> players;
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
// Querying KakaoTalk Invitation Target List
kgKakaoInvitation.loadInvitableFriendProfiles(recommendLimit , offset, limit, result, players);
if (result.isSuccess()) {
// Success
for (KakaoGame::Data::KGKakaoProfile kakaoProfile : players) {
// KakaoTalk nickname
std::wtring nickname = kakaoProfile.nickname;
// KakaoTalk profile thumbnail image url
std::wtring thumbnailImageUrl = kakaoProfile.thumbnailImageUrl;
// KakaoTalk installation os
KakaoGame::Data::KGOSType kakaoTalkOS = kakaoProfile.kakaoTalkOS;
// Whether your friends are allowed to get messages or not. You must not send message if it is 'false'.
bool allowedMessage = kakaoProfile.allowedMessage;
}
}
else if (result.code == KakaoGame::Data::KGResultCode::NotKakaoTalkUser)
{
// The user is not a KakaoTalk user.
}
else
{
// Fail...
} |
Windows Async
...
코드 블럭 |
---|
#include "KakaoGameLib.h"
// [TODO] Set limit of recommended friends
int32_t recommendLimit = 5; // The number of recommended friends
// int32_t recommendLimit = 0; // Set to 0 if you want to fetch the list without recommended friends
// int32_t recommendLimit = -1; // Set it to -1 if you want to include all of your recommended friends (the number of recommended friends is variably)
// [TODO] Set start value for querying friend list
int32_t offset; // Start value for querying friend list
// [TODO] Set size of querying friend list
int32_t limit; // Friend list size
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
// Querying KakaoTalk Invitation Target List
kgKakaoInvitation.loadInvitableFriendProfiles(recommendLimit, offset, limit, [this](KakaoGame::Data::KGResult result, std::vector<KakaoGame::Data::KGKakaoProfile> players) {
if (result.isSuccess()) {
// Success
for (KakaoGame::Data::KGKakaoProfile kakaoProfile : players)
{
// KakaoTalk nickname
std::wtring nickname = kakaoProfile.nickname;
// KakaoTalk profile thumbnail image url
std::wtring thumbnailImageUrl = kakaoProfile.thumbnailImageUrl;
// KakaoTalk installation os
KakaoGame::Data::KGOSType kakaoTalkOS = kakaoProfile.kakaoTalkOS;
// Whether your friends are allowed to get messages or not. You must not send message if it is 'false'.
bool allowedMessage = kakaoProfile.allowedMessage;
}
}
else if (result.code == KakaoGame::Data::KGResultCode::NotKakaoTalkUser) {
// The user is not a KakaoTalk user.
}
else {
// Fail...
}
}); |
Unreal
...
코드 블럭 |
---|
#include "KakaoGame.h"
// [TODO] Set start value for querying friend list
int32 offset = 0; // Start value for querying friend list
// [TODO] Set size of querying friend list
int32 limit = 500; // Friend list size
// Querying KakaoTalk Invitation Target List
FKGKakaoInvitation::LoadInvitableFriendProfiles(0, offset, limit, FKGResultWithKakaoProfilesDelegate::CreateLambda([=](FKGResult result, int32 totalCount, TArray<FKGKakaoProfile> kakaoProfiles) {
if (result.IsSuccess())
{
// Success
for (FKGKakaoProfile kakaoProfile : kakaoProfiles)
{
// KakaoTalk nickname
FString nickname = kakaoProfile.GetNickname();
// KakaoTalk profile thumbnail image url
FString thumbnailImageUrl = kakaoProfile.GetThumbnailImageUrl();
// KakaoTalk installation os
EKGOSType talkOs = kakaoProfile.GetKakaoTalkOS();
// Whether your friends are allowed to get messages or not. You must not send message if it is 'false'.
bool isAllowMessage = kakaoProfile.IsAllowedMessage();
}
}
else if (result.GetCode() == FKGResultCode::NotKakaoTalkUser)
{
// The user is not a KakaoTalk user.
}
else
{
// Fail
}
})); |
21.1.3. Sending a KakaoTalk Invitation Message
This section shows an example of KakaoTalk invitation message sending. (Guide : 20. Kakaotalk Message Template V2)
Unity 예제
...
코드 블럭 |
---|
using Kakaogame.SDK;
using Kakaogame.SDK.Kakao;
// [TODO] Set event Id
int eventId = 511; // Send the invitation message for this event
// [TODO] Set invitation message template ID
int templateId = 4100; // The Id value of the template created by the Message Template Admin
// [TODO] Add required arguments to invitation message
String nickname = ((KGKakaoProfile) KGLocalPlayer.getCurrentPlayer().getIdpProfile()).getNickname();
Map<String, String> args = new LinkedHashMap<String, String>();
args.put("${sender_name}", nickname);
// [TODO] Set up recipient profiles
KGKakaoProfile kakaoProfile; // The profile object looked up by 'loadInvitableFriendProfiles'
// Send a Kakaotalk invitation message
KGKakaoInvitation.SendInviteMessage(eventId, kakaoProfile, templateId, args, (result) => {
if (result.isSuccess)
{
// Success
}
else
{
// Failed to send Kakao Talk invitation message
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 if (result.code == KGResultCode.NotKakaoTalkUser)
{
// The user is not a KakaoTalk user.
}
else
{
// Other errors...
}
}
}); |
Android 예제
...
코드 블럭 |
---|
import com.kakaogame.KGKakaoInvitation;
import com.kakaogame.KGLocalPlayer;
import com.kakaogame.KGKakaoProfile;
import com.kakaogame.KGResult;
// [TODO] Set event Id
int eventId = 511; // Send the invitation message for this event
// [TODO] Set invitation message template ID
int templateId = 4100; // The Id value of the template created by the Message Template Admin
// [TODO] Add required arguments to invitation message
string nickname = ((KGKakaoProfile) KGLocalPlayer.currentPlayer.idpProfile).nickname;
Dictionary<String, String> args = new Dictionary<String, String>();
args.add("${sender_name}", nickname);
// [TODO] Set up recipient profiles
KGKakaoProfile kakaoProfile; // The profile object looked up by 'loadInvitableFriendProfiles'
// Send a Kakaotalk invitation message
KGKakaoInvitation.sendInviteMessage(eventId, kakaoProfile, templateId, args, new KGResultCallback<Void>() {
@Override
public void onResult(KGResult<Void> result) {
if (result.isSuccess()) {
// Success
} else {
// Failed to send Kakao Talk invitation message
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 if (result.getCode() == KGResult.KGResultCode.NOT_KAKAOTALK_USER) {
// The user is not a KakaoTalk user.
} else {
// Other errors...
}
}
}
}); |
iOS 예제
...
코드 블럭 |
---|
#import <KakaoGame/KakaoGame.h>
// [TODO] Set event Id
int eventId = 511; // Send the invitation message for this event
// [TODO] Set invitation message template ID
int templateId = 4100; // The Id value of the template created by the Message Template Admin
// [TODO] Add required arguments to invitation message
String nickname = ((KGKakaoProfile) KGLocalPlayer.getCurrentPlayer().getIdpProfile()).getNickname();
Map<String, String> args = new LinkedHashMap<String, String>();
args.put("${sender_name}", nickname);
// [TODO] Set up recipient profiles
KGKakaoProfile kakaoProfile; // The profile object looked up by 'loadInvitableFriendProfiles'
// Send a Kakaotalk invitation message
[KGKakaoInvitation sendInviteMessageWithEventId:eventId kakaoProfile:kakaoProfile templateId:templateId argumentDic:args (result) => {
if (IS_SUCCESS(error) == YES)
{
// Success
}
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 == KGErrorExceedMothlyUsage)
{
// 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 user is not a KakaoTalk user.
}
else
{
// Failed to send Kakao Talk invitation message
}
}]; |
Windows Sync
...
코드 블럭 |
---|
#include "KakaoGameLib.h"
KakaoGame::Data::KGLocalPlayer localPlayer;
KakaoGame::API::KGLocalPlayer kgLocalPlayer;
// [TODO] Bring your own profile object
getCurrentPlayer(localPlayer);
// [TODO] Set event Id
int32_t eventId = 511; // Send the invitation message for this event
// [TODO] Set invitation message template ID
int32_t templateId = 4100; // The Id value of the template created by the Message Template Admin
// [TODO] Add required arguments to invitation message
std::map<std::wstring, std::wstring> arguments;
arguments.insert(std::pair<std::wstring, std::wstring>(TEXT("${sender_name}"), localPlayer.kakaoProfile.nickname));
// [TODO] Set up recipient profiles
KakaoGame::Data::KGKakaoProfile kakaoProfile; // The profile object looked up by 'loadInvitableFriendProfiles'
KakaoGame::Data::KGResult result;
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
// Send a Kakaotalk invitation message
kgKakaoInvitation.sendInviteMessage(eventId, kakaoProfile, templateId, arguments, result);
if (result.isSuccess()) {
// Success
}
else {
// Failed to send Kakao Talk invitation message
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 user is not a KakaoTalk user.
} else {
// Other errors...
}
} |
Windows Async
...
21.1.2. Querying KakaoTalk Invitation Target List
This section shows an example of a query of the KakaoTalk invitation target list.
KakaoGame Platform will recommended friends who will join the game with high possibility. The number of recommended friends may less than the number of recommend limt you have set.
When sending an invitation message to KakaoTalk, you must pass the 'KakaoProfile' object received using this API as an argument.
The friend list is first listed according to the ranking given by the server on the recommend limit, and then sorted in alphabetical order.
If you want to show recommended friends in the UI, you can use the 'isRecommended' argument.
Unity 예제
코드 블럭 |
---|
using Kakaogame.SDK;
using Kakaogame.SDK.Kakao;
// [TODO] Set limit of recommended friends
int recommendLimit = 5; // The number of recommended friends
// int recommendLimit = 0; // Set to 0 if you want to fetch the list without recommended friends
// int recommendLimit = -1; // Set it to -1 if you want to include all of your recommended friends (the number of recommended friends is variably)
// [TODO] Set |
|
up recipient profiles
KakaoGame::Data::KGKakaoProfile kakaoProfilestart value for querying friend list
int offset; // |
|
The profile object looked up by 'loadInvitableFriendProfiles'
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
Start value for querying friend list
// [TODO] Set size of querying friend list
int limit; // Friend list size
// |
|
SendaKakaotalkinvitationmessagekgKakaoInvitationsendInviteMessageLoadInvitableFriendProfiles( |
|
eventIdkakaoProfiletemplateIdarguments[this](KakaoGame::Data::KGResult result)totalCount, kakaoProfiles) => {
if (result.isSuccess |
|
() } else {
FailedtosendKakaoTalkinvitationmessage if result.code == KakaoGame::Data::KGResultCode::MessageSettingDisabledKGKakaoProfile kakaoProfile in kakaoProfiles)
{
// |
|
If the recipient has opted-out of the message
} else if (result.code == KakaoGame::Data::KGResultCode::ExceedDailyUsage) { KakaoTalk nickname
string nickname = kakaoProfile.nickname;
// KakaoTalk profile thumbnail image url
string thumbnailImageUrl = kakaoProfile.thumbnailImageUrl;
// |
|
Occurswhenthereday'squota(regardlessofrecipient)thatone person can send for a particular app
} else if (result.code == KakaoGame::Data::KGResultCode::ExceedMonthlyUsage) {= kakaoProfile.isRecommended;
// KakaoTalk installation os
string talkOs = kakaoProfile.kakaoTalkOS.ToString();
// |
|
Occurs when one month exceeds a month's quota that a specific person can send to a particular app
} else if Whether your friends are allowed to get messages or not. You must not send message if it is 'false'.
bool isAllowMessage = kakaoProfile.isAllowedMessage;
}
}
else if (result.code == |
|
KakaoGame::Data::KGResultCode::KGResultCode.NotKakaoTalkUser)
{
|
|
// The user is not a KakaoTalk user.
|
|
} else Other errors }
UnrealAndroid 예제
#include "KakaoGame.h"import com.kakaogame.KGKakaoInvitation;
import com.kakaogame.KGKakaoProfile;
import com.kakaogame.KGKakaoProfile.KGKakaoFriendsResponse;
import com.kakaogame.KGResult;
// [TODO] Set limit |
|
eventIdint32eventId 511Sendtheinvitationmessageforthisevent [TODO] Set invitation message template ID
FString templateId = TEXT("4100"); // The Id value of the template created by the Message Template Admin
Set to 0 if you want to fetch the list without recommended friends
// int recommendLimit = -1; // Set it to -1 if you want to include all of your recommended friends (the number of recommended friends is variably)
// [TODO] |
|
AddrequiredargumentstoinvitationmessageFKGIdpProfile idpProfile = FKGLocalPlayer::GetCurrentPlayer().GetIdpProfile();
FKGKakaoProfile *localKakaoProfile = (FKGKakaoProfile*)&idpProfile;
FString nickname = localKakaoProfile->GetNickname();
TSharedPtr<FJsonObject> argumentMap = MakeShareable(new FJsonObject);
argumentMap->SetStringField(TEXT("${sender_name}"), nickname);
list
int offset; // Start value for querying friend list
// [TODO] Set |
|
uprecipientprofilesFKGKakaoProfilekakaoProfileTheprofileobject looked up by 'loadInvitableFriendProfiles'
SendaKakaotalkinvitationmessage
FKGKakaoInvitation::SendInviteMessage(eventId, kakaoProfile, templateId, argumentMap, FKGResultDelegate::CreateLambda([=](FKGResultList
KGKakaoInvitation.loadInvitableFriendProfiles(recommendLimit, offset, limit, new KGResultCallback<KGKakaoFriendsResponse>() {
@Override
public void onResult(KGResult<KGKakaoFriendsResponse> result) {
|
|
if IsSuccess
}
else
{
// Failed to send Kakao Talk invitation message
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 if (result.GetCode() == FKGResultCode::NotKakaoTalkUser)
{
// The user is not a KakaoTalk user.
}
else
{
// Other errors
}
}
})); 21.1.4. Querying the number of friends I sent an invitation to
This section shows an example of a query of the count of friends who have received my invitation.
Unity 예제
...
코드 블럭 |
---|
using KakaoGame.SDK;
using KakaoGame.SDK.Kakao;
// [TODO] Set event Id
int eventId = 511; // Querying this invitation event
KGKakaoInvitation.LoadReceiversCount(eventId, (result, totalReceiversCount, joinersCount) => {
if (result.isSuccess)
{
// Success
// Total receivers count
int totalCount = totalReceiversCount;
// Number of friends who joined the game
int registeredCount = joinersCount;
}
else
{
// Fail...
}
}); |
Android 예제
코드 블럭 |
import com.kakaogame.KGKakaoInvitation;
import com.kakaogame.KGKakaoInvitation.KGInvitationReceviersResponse;
import com.kakaogame.KGPlayer;
import com.kakaogame.KGKakaoProfile;
import com.kakaogame.KGResult;
// Query of invitation target friend profile list successful
KGKakaoFriendsResponse response = result.getContent();
// Total count of friends you can invite
int totalCount = response.getTotalCount();
// Invite Friend List - list of friend profile objects to use when sending invitation messages
List<KGKakaoProfile> friendList = response.getFriendList();
for (KGKakaoProfile kakaoProfile : friendList) {
// KakaoTalk nickname
String nickname = kakaoProfile.getNickname();
// KakaoTalk profile thumbnail image url
String thumbnailImageUrl = kakaoProfile.getThumbnailImageUrl();
// If this user is a recommended friend or not
boolean isRecommended = kakaoProfile.isRecommended();
// KakaoTalk installation os
String talkOs = kakaoProfile.getTalkOs();
// Whether your friends are allowed to get messages or not. You must not send message if it is 'false'.
boolean isAllowMessage = kakaoProfile.isAllowedMessage();
}
} else if (result.getCode() == KGResult.KGResultCode.NOT_KAKAOTALK_USER) {
// The user is not a KakaoTalk user.
} else {
// Fail...
}
}
}); |
|
iOS 예제
코드 블럭 |
---|
#import <KakaoGame/KakaoGame.h>
// [TODO] Set |
|
event Id
int eventId = 511; // Querying this invitation event
// Querying the number of friends I sent an invitation to
KGKakaoInvitation.loadReceiversCount(eventId, new KGResultCallback<KGInvitationReceviersCountResponse>() {
@Override
public void onResult(KGResult<KGInvitationReceviersCountResponse> result) {
if (result.isSuccess()) {
// Success
KGInvitationReceviersCountResponse response = result.getContent();
// Total receivers count
int total = response.getTotalReceiversCount();
// Number of friends who joined the game
int joinersCount = response.getJoinersCount();
} else {
// Fail...
}
}
});iOS 예제
코드 블럭 |
#import <KakaoGame/KakaoGame.h>
limit of recommended friends
int recommendLimit = 5; // The number of recommended friends
// int recommendLimit = 0; // Set to 0 if you want to fetch the list without recommended friends
// int recommendLimit = -1; // Set it to -1 if you want to include all of your recommended friends (the number of recommended friends is variably)
// [TODO] Set start value for querying friend list
int offset; // Start value for querying friend list
// [TODO] Set size |
|
eventIdint eventId=511; int limit; // Friend list size
// Querying |
|
this invitation event
[KGKakaoInvitation loadReceiversCountWithEventId:eventIdKakaoTalk Invitation Target List
[KGKakaoInvitation loadInvitableFriendProfilesWithRecommendLimit:recommendLimit offset:offset limit:limit completionHandler:^(NSError *error, |
|
int totalReceiversCount, int joinersCount int totalCount, NSArray *idpProfiles) {
if (IS_SUCCESS(error) == YES)
{
// Success
|
|
Total receivers count
int totalCount = totalReceiversCount;
// Number of friends who joined the game
int registeredCount = joinersCount;
}
else
{
// Fail...
}
}];Windows Sync
...
코드 블럭 |
---|
#include "KakaoGameLib.h"
// [TODO] Set event Id
int32_t eventId = 511; // Querying this invitation event
KakaoGame::Data::KGResult result;
int32_t totalReceiversCount;
int32_t joinersCount;
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
// Querying the number of friends I sent an invitation to
kgKakaoInvitation.loadReceiversCount(eventId, result, totalReceiversCount, joinersCount);
if (result.isSuccess()) {
// Success
// Total receivers count
int totalCount = totalReceiversCount;
// Number of friends who joined the game
int registeredCount = joinersCount;
}
else {
// Fail...
} |
Windows Async
코드 블럭 |
#include "KakaoGameLib.h" Query of invitation target friend profile list successful
for (KGKakaoProfile *kakaoProfile in idpProfiles)
{
// KakaoTalk nickname
NSString *nickname = kakaoProfile.nickname;
// KakaoTalk profile thumbnail image url
NSString *thumbnailImageUrl = kakaoProfile.thumbnailImageUrl;
// If this user is a recommended friend or not
BOOL isRecommended = kakaoProfile.isRecommended;
// KakaoTalk installation os
NSString *talkOs = kakaoProfile.kakaoTalkOS.description;
// Whether your friends are allowed to get messages or not. You must not send message if it is 'false'.
BOOL isAllowMessage = kakaoProfile.isAllowedMessage;
}
}
else if (error.code == KGErrorNotKakaoTalkUser)
{
// The user is not a KakaoTalk user.
}
else
{
// Fail...
}
}]; |
|
21.1.3. Sending a KakaoTalk Invitation Message
This section shows an example of KakaoTalk invitation message sending. (Guide : 20. Kakaotalk Message Template V2)
Unity 예제
코드 블럭 |
---|
using Kakaogame.SDK;
using Kakaogame.SDK.Kakao;
// [TODO] Set event Id
|
|
int32_t eventIdQueryingthisevent
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
QueryingthenumberoffriendsIsentan invitation to
kgKakaoInvitation.loadReceiversCount(eventId, [this](KakaoGame::Data::KGResult result, int32_t totalReceiversCount, int32_t joinersCount) {
if (result.isSuccess()) {
// Success
// Total receivers count
int totalCount = totalReceiversCount;
// Number of friends who joined the game
int registeredCount = joinersCount;
}
else {
// Fail...
}
});Unreal
코드 블럭 |
#include "KakaoGame.h"= 4100; // The Id value of the template created by the Message Template Admin
// [TODO] Add required arguments to invitation message
String nickname = ((KGKakaoProfile) KGLocalPlayer.getCurrentPlayer().getIdpProfile()).getNickname();
Map<String, String> args = new LinkedHashMap<String, String>();
args.put("${sender_name}", nickname);
// [TODO] Set |
|
eventIdint32eventId= 511 Querying this invitation event
FKGKakaoInvitation::LoadReceiversCount(eventId, FKGResultWithReceiversCountDelegate::CreateLambda([=](FKGResult result, int32 totalReceiversCount, int32 joinersCount) {
if (result.IsSuccess())
{
The profile object looked up by 'loadInvitableFriendProfiles'
// Send a Kakaotalk invitation message
KGKakaoInvitation.SendInviteMessage(eventId, kakaoProfile, templateId, args, (result) => {
if (result.isSuccess)
{
// Success
}
else
{
// |
|
Total receivers count
int32 totalCount = totalReceiversCount;
// Number of friends who joined the game
int32 registeredCount = joinersCount;
}
else
{
// Fail
}
}));21.1.5. Querying the list of friends I sent an invitation to
This section shows an example of a query of the list of friends who have received my invitation.
Unity 예제
코드 블럭 |
using KakaoGame.SDK;
using KakaoGame.SDK.Kakao;
// [TODO] Set event Id
int eventId = 511; // Querying this invitation event
// Querying the list of friends I sent an invitation to
KGKakaoInvitation.LoadReceivers(eventId, (result, joiners, invitees) => {
if (result.isSuccess)
{
// Success
// List of players joined to the app, including unlink users
foreach (KGPlayer joiner in joiners) Failed to send Kakao Talk invitation message
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 if (result.code == KGResultCode.NotKakaoTalkUser)
{
// The user is not a KakaoTalk user.
}
else
{
// |
|
Receiver's playerId
string playerId = joiner.playerId;
KGKakaoProfile kakaoProfile = (KGKakaoProfile)joiner.idpProfile;
// Receiver's nickname
string nickname = kakaoProfile.nickname;
// Receiver's KakaoTalk thumbnail profile image url
string thumbnailImageUrl = kakaoProfile.thumbnailImageUrl;
// If the player has unlinked this app or not
// If you want to display information on whether or not to leave the UI, use this flag
BOOL isUnregistered = kakaoProfile.isUnregistered;
}
// List of recipients who have not yet joined the app
// Player ID is not provided because the user has not signed up for the app
foreach (KGKakaoPrfoile invitee in invitees)
{
// Receiver's nickname
string nickname = invitee.nickname;
// Receiver's KakaoTalk thumbnail profile image url
string thumbnailImageUrl = invitee.thumbnailImageUrl;
}
}
else if (result.code == KGResultCode.NotKakaoTalkUser)
{
// The user is not a KakaoTalk user.
}
else
{
// Fail...
}
});Android 예제
...
코드 블럭 |
---|
import com.kakaogame.KGKakaoInvitation;
import com.kakaogame.KGKakaoInvitation.KGInvitationReceviersResponse;
import com.kakaogame.KGPlayer;
import com.kakaogame.KGKakaoProfile;
import com.kakaogame.KGResult;
// [TODO] Set event Id
int eventId = 511; // Querying this invitation event
// Querying the list of friends I sent an invitation to
KGKakaoInvitation.loadReceivers(eventId, new KGResultCallback<KGKakaoInvitation.KGInvitationReceviersResponse>() {
@Override
public void onResult(KGResult<KGKakaoInvitation.KGInvitationReceviersResponse> result) {
if (result.isSuccess()) {
// Success
KGKakaoInvitation.KGInvitationReceviersResponse receivers = result.getContent();
// List of players joined to the app, including unlink users
List<KGPlayer> joiners = receivers.getJoiners();
for (KGPlayer player : joiners) {
// Receiver's playerId
String playerId = player.getPlayerId();
KGKakaoProfile kakaoProfile = (KGKakaoProfile) player.getIdpProfile();
// Receiver's nickname
String nickname = kakaoProfile.getNickname();
// Receiver's KakaoTalk thumbnail profile image url
String thumbnailImageUrl = kakaoProfile.getThumbnailImageUrl();
// If the player has unlinked this app or not
// If you want to display information on whether or not to leave the UI, use this flag
boolean isUnregistered = kakaoProfile.isUnregistered();
}
// List of recipients who have not yet joined the app
// Player ID is not provided because the user has not signed up for the app
List<KGKakaoProfile> invitees = receivers.getInvitees();
for (KGKakaoProfile kakaoProfile : invitees) {
// Receiver's nickname
String nickname = kakaoProfile.getNickname();
// Receiver's KakaoTalk thumbnail profile image url
String thumbnailImageUrl = kakaoProfile.getThumbnailImageUrl();
}
} else if (result.getCode() == KGResult.KGResultCode.NOT_KAKAOTALK_USER) {
// The user is not a KakaoTalk user.
} else {
// Fail...
}
}
}); |
iOS 예제
...
코드 블럭 |
---|
#import <KakaoGame/KakaoGame.h>
// [TODO] Set event Id
int eventId = 511; // Querying this invitation event
// Querying the list of friends I sent an invitation to
[KGKakaoInvitation loadReceiversWithEventId:eventId completionHandler:^(NSError *error, NSArray *joiners, NSArray *invitees) {
if (IS_SUCCESS(error) == YES)
{
// Success
// List of players joined to the app, including unlink users
for (KGPlayer *joiner in joiners)
{
// Receiver's playerId
NSString *playerId = joiner.playerId;
KGKakaoProfile *kakaoProfile = (KGKakaoProfile*)joiner.idpProfile;
// Receiver's nickname
NSString *nickname = kakaoProfile.nickname;
// Receiver's KakaoTalk thumbnail profile image url
NSString *thumbnailImageUrl = kakaoProfile.thumbnailImageUrl;
// If the player has unlinked this app or not
// If you want to display information on whether or not to leave the UI, use this flag
BOOL isUnregistered = kakaoProfile.isUnregistered;
}
// List of recipients who have not yet joined the app
// Player ID is not provided because the user has not signed up for the app
for (KGKakaoPrfoile *invitee in invitees)
{
// Receiver's nickname
NSString *nickname = invitee.nickname;
// Receiver's KakaoTalk thumbnail profile image url
NSString *thumbnailImageUrl = invitee.thumbnailImageUrl;
}
}
else if (error.code == KGErrorNotKakaoTalkUser)
{
// The user is not a KakaoTalk user.
}
else
{
// Fail...
}
}]; |
Windows Sync
코드 블럭 |
#include "KakaoGameLib.h"Android 예제
코드 블럭 |
---|
import com.kakaogame.KGKakaoInvitation;
import com.kakaogame.KGLocalPlayer;
import com.kakaogame.KGKakaoProfile;
import com.kakaogame.KGResult;
// [TODO] Set event Id
int eventId = 511; // Send the invitation message for this event
// [TODO] Set invitation message template ID
int templateId = 4100; // The Id value of the template created by the Message Template Admin
// [TODO] Add required arguments to invitation message
string nickname = ((KGKakaoProfile) KGLocalPlayer.currentPlayer.idpProfile).nickname;
Dictionary<String, String> args = new Dictionary<String, String>();
args.add("${sender_name}", nickname);
// [TODO] Set up recipient profiles
KGKakaoProfile kakaoProfile; // The profile object looked up by 'loadInvitableFriendProfiles'
// Send a Kakaotalk invitation message
KGKakaoInvitation.sendInviteMessage(eventId, kakaoProfile, templateId, args, new KGResultCallback<Void>() {
@Override
public void onResult(KGResult<Void> result) {
if (result.isSuccess()) {
// Success
} else {
// Failed to send Kakao Talk invitation message
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 if (result.getCode() == KGResult.KGResultCode.NOT_KAKAOTALK_USER) {
// The user is not a KakaoTalk user.
} else {
// Other errors...
}
}
}
}); |
|
iOS 예제
코드 블럭 |
---|
#import <KakaoGame/KakaoGame.h>
// [TODO] Set event Id
int eventId = 511; // Send the invitation message for this event
// [TODO] Set invitation message template ID
int templateId = 4100; // The Id value of the template created by the Message Template Admin
// [TODO] Add required arguments to invitation message
String nickname = ((KGKakaoProfile) KGLocalPlayer.getCurrentPlayer().getIdpProfile()).getNickname();
Map<String, String> args = new LinkedHashMap<String, String>();
args.put("${sender_name}", nickname);
// [TODO] Set up recipient profiles
KGKakaoProfile kakaoProfile; // The profile object looked up by 'loadInvitableFriendProfiles'
// Send a Kakaotalk invitation message
[KGKakaoInvitation sendInviteMessageWithEventId:eventId kakaoProfile:kakaoProfile templateId:templateId argumentDic:args (result) => {
if (IS_SUCCESS(error) == YES)
{
// Success
}
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 == KGErrorExceedMothlyUsage)
{
// 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 user is not a KakaoTalk user.
}
else
{
// Failed to send Kakao Talk invitation message
}
}]; |
|
21.1.4. Querying the number of friends I sent an invitation to
This section shows an example of a query of the count of friends who have received my invitation.
Unity 예제
코드 블럭 |
---|
using KakaoGame.SDK;
using KakaoGame.SDK.Kakao;
// [TODO] Set event Id
int eventId = 511; // Querying this invitation event
KGKakaoInvitation.LoadReceiversCount(eventId, (result, totalReceiversCount, joinersCount) => {
if (result.isSuccess)
{
// Success
// Total receivers count
int totalCount = totalReceiversCount;
// Number of friends who joined the game
int registeredCount = joinersCount;
}
else
{
// Fail...
}
}); |
|
Android 예제
코드 블럭 |
---|
import com.kakaogame.KGKakaoInvitation;
import com.kakaogame.KGKakaoInvitation.KGInvitationReceviersResponse;
import com.kakaogame.KGPlayer;
import com.kakaogame.KGKakaoProfile;
import com.kakaogame.KGResult;
// [TODO] Set event Id
int eventId = 511; // Querying this invitation event
// Querying the number of friends I sent an invitation to
KGKakaoInvitation.loadReceiversCount(eventId, new KGResultCallback<KGInvitationReceviersCountResponse>() {
@Override
public void onResult(KGResult<KGInvitationReceviersCountResponse> result) {
if (result.isSuccess()) {
// Success
KGInvitationReceviersCountResponse response = result.getContent();
// Total receivers count
int total = response.getTotalReceiversCount();
// Number of friends who joined the game
int joinersCount = response.getJoinersCount();
} else {
// Fail...
}
}
}); |
|
iOS 예제
코드 블럭 |
---|
#import <KakaoGame/KakaoGame.h>
// [TODO] Set event |
|
Idint32_teventIdint eventId = 511; // Querying this invitation event
|
|
KakaoGame::Data::KGResult result;
std::vector<KakaoGame::Data::KGPlayer> joiners;
std::vector<KakaoGame::Data::KGKakaoProfile> invitees;
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
// Querying the list of friends I sent an invitation to
kgKakaoInvitation.loadReceivers(eventId, result, joiners, invitees);
if (result.isSuccess()) {
// Success
// List of players joined to the app, including unlink users
for (KakaoGame::Data::KGPlayer joiner : joiners) {
// Receiver's playerId
std::wstring playerId = player.playerId;
KakaoGame::Data::KGKakaoProfile kakaoProfile = player.kakaoProfile;
// Receiver's nickname
std::wstring nickname = kakaoProfile.nickname;
// Receiver's KakaoTalk thumbnail profile image url
std::wstring thumbnailImageUrl = kakaoProfile.thumbnailImageUrl;
// If the player has unlinked this app or not
// If you want to display information on whether or not to leave the UI, use this flag
bool unregistered = kakaoProfile.unregistered;
}
// List of recipients who have not yet joined the app
// Player ID is not provided because the user has not signed up for the app
for (KakaoGame::Data::KGKakaoProfile invitee : invitees) {
// Receiver's nickname
std::wstring nickname = invitee.nickname;
// Receiver's KakaoTalk thumbnail profile image url
std::wstring thumbnailImageUrl= invitee.thumbnailImageUrl;
}
}
else
{
// Fail...
}Windows Async
코드 블럭 |
#include "KakaoGameLib.h"
// [TODO] Set event Id
int32_t eventId = 511; // Querying this invitation event
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
// Querying the list of friends I sent an invitation to
kgKakaoInvitation.loadReceivers(eventId, [this](KakaoGame::Data::KGResult result, std::vector<KakaoGame::Data::KGPlayer> joiners, std::vector<KakaoGame::Data::KGKakaoProfile> invitees) {
if (result.isSuccess()
[KGKakaoInvitation loadReceiversCountWithEventId:eventId completionHandler:^(NSError *error, int totalReceiversCount, int joinersCount) {
if (IS_SUCCESS(error) == YES)
{
// Success
// Total receivers count
int totalCount = totalReceiversCount;
// Number of friends who joined the game
int registeredCount = joinersCount;
}
else
{
// Fail...
}
}]; |
|
21.1.5. Querying the list of friends I sent an invitation to
This section shows an example of a query of the list of friends who have received my invitation.
Unity 예제
코드 블럭 |
---|
using KakaoGame.SDK;
using KakaoGame.SDK.Kakao;
// [TODO] Set event Id
int eventId = 511; // Querying this invitation event
// Querying the list of friends I sent an invitation to
KGKakaoInvitation.LoadReceivers(eventId, (result, joiners, invitees) => {
if (result.isSuccess)
{
// Success
// List of players joined to the app, including unlink users
foreach (KGPlayer joiner in joiners)
{
// Receiver's playerId
string playerId = joiner.playerId;
KGKakaoProfile kakaoProfile = (KGKakaoProfile)joiner.idpProfile;
// Receiver's nickname
string nickname = kakaoProfile.nickname;
// Receiver's KakaoTalk thumbnail profile image url
string thumbnailImageUrl = kakaoProfile.thumbnailImageUrl;
// If the player has unlinked this app or not
// If you want to display information on whether or not to leave the UI, use this flag
BOOL isUnregistered = kakaoProfile.isUnregistered;
}
// List of recipients who have not yet joined the app
// Player ID is not provided because the user has not signed up for the app
foreach (KGKakaoPrfoile invitee in invitees)
{
// Receiver's nickname
string nickname = invitee.nickname;
// Receiver's KakaoTalk thumbnail profile image url
string thumbnailImageUrl = invitee.thumbnailImageUrl;
}
}
else if (result.code == KGResultCode.NotKakaoTalkUser)
{
// |
|
Success //Listofplayersjoinedtothe app, including unlink users
for (KakaoGame::Data::KGPlayer joiner : joiners) {
// Receiver's playerId
std::wstring playerId = player.playerId;
KakaoGame::Data::KGKakaoProfile kakaoProfile = player.kakaoProfile;
// Receiver's nickname
std::wstring nickname = kakaoProfile.nickname;
// Receiver's KakaoTalk thumbnail profile image url
std::wstring thumbnailImageUrl = kakaoProfile.thumbnailImageUrl;
// If the player has unlinked this app or not
// If you want to display information on whether or not to leave the UI, use this flag
bool unregistered = kakaoProfile.unregistered;
}
// List of recipients who have not yet joined the app
// Player ID is not provided because the user has not signed up for the app
for (KakaoGame::Data::KGKakaoProfile invitee : invitees) {
Android 예제
코드 블럭 |
---|
import com.kakaogame.KGKakaoInvitation;
import com.kakaogame.KGKakaoInvitation.KGInvitationReceviersResponse;
import com.kakaogame.KGPlayer;
import com.kakaogame.KGKakaoProfile;
import com.kakaogame.KGResult;
// [TODO] Set event Id
int eventId = 511; // Querying this invitation event
// Querying the list of friends I sent an invitation to
KGKakaoInvitation.loadReceivers(eventId, new KGResultCallback<KGKakaoInvitation.KGInvitationReceviersResponse>() {
@Override
public void onResult(KGResult<KGKakaoInvitation.KGInvitationReceviersResponse> result) {
if (result.isSuccess()) {
// Success
KGKakaoInvitation.KGInvitationReceviersResponse receivers = result.getContent();
// List of players joined to the app, including unlink users
List<KGPlayer> joiners = receivers.getJoiners();
for (KGPlayer player : joiners) {
// Receiver's playerId
String playerId = player.getPlayerId();
KGKakaoProfile kakaoProfile = (KGKakaoProfile) player.getIdpProfile();
// Receiver's nickname
|
|
std::wstringinviteenickname
// Receiver's KakaoTalk thumbnail profile image url |
|
std::wstring thumbnailImageUrl
String thumbnailImageUrl = |
|
invitee.thumbnailImageUrl;
}
}
else
{
// Fail...
}
});Unreal
코드 블럭 |
#include "KakaoGame.h"
// [TODO] Set event Id
int32 eventId = 511; // Querying this invitation event
FKGKakaoInvitation::LoadReceivers(eventId, FKGResultWithReceiversDelegate::CreateLambda([=](FKGResult result, TArray<FKGPlayer> joiners, TArray<FKGKakaoProfile> invitees) {
if (result.IsSuccess())
{
// Success
// List of players joined to the app, including unlink users
for (FKGPlayer player : joiners)
{
kakaoProfile.getThumbnailImageUrl();
// If the player has unlinked this app or not
// If you want to display information on whether or not to leave the UI, use this flag
boolean isUnregistered = kakaoProfile.isUnregistered();
}
// List of recipients who have not yet joined the app
// Player ID is not provided because the user has not signed up for the app
List<KGKakaoProfile> invitees = receivers.getInvitees();
for (KGKakaoProfile kakaoProfile : invitees) {
// Receiver's |
|
playerId FStringplayerIdplayerGetPlayerId();
FKGIdpProfile idpProfile = player.GetIdpProfilegetNickname();
// Receiver's KakaoTalk thumbnail profile image url
String thumbnailImageUrl = kakaoProfile.getThumbnailImageUrl();
|
|
FKGKakaoProfile *kakaoProfile }
} else if (result.getCode() = |
|
(FKGKakaoProfile*)&idpProfile;
// Receiver's nickname
FString nickname = kakaoProfile->GetNickname();
// Receiver's KakaoTalk thumbnail profile image url
FString thumbnailImageUrl = kakaoProfile->GetThumbnailImageUrl();
// If the player has unlinked this app or not
// If you want to display information on whether or not to leave the UI, use this flag
bool unregistered = kakaoProfile->IsUnregistered();
}
// List of recipients who have not yet joined the app
// Player ID is not provided because the user has not signed up for the app
for (FKGKakaoProfile invitee : invitees)
{
// Receiver's nickname
FString inviteeNickname = invitee.GetNickname();
// Receiver's KakaoTalk thumbnail profile image url
FString inviteeThumbnailImageUrl = invitee.GetThumbnailImageUrl();
}
}
else
{
// Fail
}
}));21.1.6. Querying the count of players who invited you
This section shows an example of a query the count of players who invited you.
Unity 예제
...
코드 블럭 |
---|
using KakaoGame.SDK;
using KakaoGame.SDK.Kakao;
// [TODO] Set event Id
int eventId = 511; // Querying this invitation event
KGKakaoInvitation.LoadSendersCount(eventId, (result, count) => {
if (result.isSuccess)
{
// Success
// Get the number of players who invited you
int senderCount = count;
}
else
{
// Fail...
}
}); |
Android 예제
...
코드 블럭 |
---|
import com.kakaogame.KGKakaoInvitation;
import com.kakaogame.KGKakaoInvitation.KGInvitationReceviersResponse;
import com.kakaogame.KGPlayer;
import com.kakaogame.KGKakaoProfile;
import com.kakaogame.KGResult;
// [TODO] Set event Id
int eventId = 511; // Querying this invitation event
KGKakaoInvitation.loadSendersCount(eventId, new KGResultCallback<Integer>() {
@Override
public void onResult(KGResult<Integer> result) {
if (result.isSuccess()) {
// Success
int count = result.getContent(); // Get the number of players who invited you
} else {
// Fail...
}
}
}); |
iOS 예제
코드 블럭 |
#import <KakaoGame/KakaoGame.h>
// [TODO] Set event Id
int eventId = 511; // Querying this invitation event
[KGKakaoInvitation loadSendersCountWithEventId:eventId completionHandler:^(NSError *error, int count) {
if (IS_SUCCESS(error) == YES= KGResult.KGResultCode.NOT_KAKAOTALK_USER) {
// The user is not a KakaoTalk user.
} else {
// Fail...
}
}
}); |
|
iOS 예제
코드 블럭 |
---|
#import <KakaoGame/KakaoGame.h>
// [TODO] Set event Id
int eventId = 511; // Querying this invitation event
// Querying the list of friends I sent an invitation to
[KGKakaoInvitation loadReceiversWithEventId:eventId completionHandler:^(NSError *error, NSArray *joiners, NSArray *invitees) {
if (IS_SUCCESS(error) == YES)
{
// Success
// List of players joined to the app, including unlink users
for (KGPlayer *joiner in joiners)
{
// Receiver's playerId
NSString *playerId = joiner.playerId;
KGKakaoProfile *kakaoProfile = (KGKakaoProfile*)joiner.idpProfile;
// Receiver's nickname
NSString *nickname = kakaoProfile.nickname;
// Receiver's KakaoTalk thumbnail profile image url
NSString *thumbnailImageUrl = kakaoProfile.thumbnailImageUrl;
// If the player has unlinked this app or not
// If you want to display information on whether or not to leave the UI, use this flag
BOOL isUnregistered = kakaoProfile.isUnregistered;
}
// List of recipients who have not yet joined the app
// Player ID is not provided because the user has not signed up for the app
for (KGKakaoPrfoile *invitee in invitees)
{
// Receiver's nickname
NSString *nickname = invitee.nickname;
// Receiver's KakaoTalk thumbnail profile image url
NSString *thumbnailImageUrl = invitee.thumbnailImageUrl;
}
}
else if (error.code == KGErrorNotKakaoTalkUser)
{
// |
|
Success //Getthenumberofplayerswhoinvited you
int senderCount = count;
}
else
{
// Fail...
}
}];Windows Sync
코드 블럭 |
#include "KakaoGameLib.h"21.1.6. Querying the count of players who invited you
This section shows an example of a query the count of players who invited you.
Unity 예제
코드 블럭 |
---|
using KakaoGame.SDK;
using KakaoGame.SDK.Kakao;
// [TODO] Set event Id
|
|
int32_teventId = 511; // Querying this invitation event
|
|
KakaoGame::Data::KGResult result;
int32_t count;
KakaoGame::API::KGKakaoInvitation kgKakaoInvitation;
kgKakaoInvitation.loadSendersCount
KGKakaoInvitation.LoadSendersCount(eventId, (result, count) |
|
;
if => {
if (result.isSuccess |
|
() // Get the number of players who invited you
|
|
int senderCount int senderCount = count;
}
else
|
|
else Windows Async
코드 블럭 |
#include "KakaoGameLib.h"Android 예제
코드 블럭 |
---|
import com.kakaogame.KGKakaoInvitation;
import com.kakaogame.KGKakaoInvitation.KGInvitationReceviersResponse;
import com.kakaogame.KGPlayer;
import com.kakaogame.KGKakaoProfile;
import com.kakaogame.KGResult;
// [TODO] Set event Id
|
|
int32_teventId 511 511; // Querying this invitation event
|
|
KakaoGame::API:: kgKakaoInvitation;
kgKakaoInvitation.loadSendersCount(eventId, |
|
[this](KakaoGame::Data::KGResult result, int32_t count new KGResultCallback<Integer>() {
@Override
public void onResult(KGResult<Integer> result) {
|
|
if if (result.isSuccess()) {
|
|
int count = result.getContent(); // Get the number of players who invited you
|
|
int senderCount = count;
}
else UnrealiOS 예제
#include"h"h>
// [TODO] Set event Id
|
|
int32eventId = 511; // Querying this invitation event
|
|
FKGKakaoInvitation::LoadSendersCount(eventId, FKGResultWithSendersCountDelegate::CreateLambda([=](FKGResult result, int32 count) {
if (result.isSuccess)
{
[KGKakaoInvitation loadSendersCountWithEventId:eventId completionHandler:^(NSError *error, int count) {
if (IS_SUCCESS(error) == YES)
{
// Success
|
|
// Get the number of players who invited you
|
|
int32senderCount else )) 21.1.7. Querying the list of players who invited you
...