21.1. KakaoTalk Invitation SDK Example
21.1. KakaoTalk Invitation SDK Example
Do not mix with new 3.9.0 or higher APIs.
21.1.1. Example of KakaoTalk Invitation Message Sending
21.1.2. Querying KakaoTalk Invitation Target List
LoadInvitableFriendProfiles(has 3 arguments) API and LoadRecommendedInvitableFriendProfiles API are deprecated. You can continue to use it, but we recommend replacing it with a new LoadInvitableFriendProfiles(has 4 arguments) API.
This section shows an example of a query of the KakaoTalk invitation target list.
KakaoGame Platform will recommend friend who will join the game with high possibility. The number of recommendable friends may less then limit of recommend friend set by you.
If you have more than 2,000 friends that you can get at once, you can only get list for 2,000 people.
'recomended' is a recommendation friend who is more likely to join a game, and you can use that value to design a differential reward. Through the callback, the list of recommended friends delivered is first arranged recommended friends with a high probability of joining, and then to be sorted by name.
Unity
using Kakaogame.SDK;
// [TODO] Set limit of recommend friend
int recommendLimit = 5;
// [TODO] Set start value for querying friend list
int offset = 0; // Start value for querying friend list
// [TODO] Set size of querying friend list
int limit = 300; // Friend list size
KGKakaoProfile.LoadInvitableFriendProfiles(
recommendLimit,
offset,
limit,
(result, totalCount, idpProfiles) => {
if (result.isSuccess) {
// Finding the list of inevitable friend profiles in KakaoTalk was successful.
// Total number of invitable KakaoTalk friends
int _totalCount = totalCount;
// List of invitable KakaoTalk friend profiles
foreach(var kakaoProfile in idpProfiles) {
// is recommended
bool isRecommended = kakaoProfile.isRecommended;
// Since the friend does not have a playerId before running the game, it can be managed by using KGKakaoProfile.uuid.
string uuid = kakaoProfile.uuid;
}
}
else {
// Finding the list of inevitable friend profiles in KakaoTalk was not successful.
}
}); |
Android
// [TODO] Set limit of recommend friend
int recommendLimit = 5;
// [TODO] Set start value of friend list query
int offset; // Friend list query start value
// [TODO] Set friend list query size
int limit; // Friend list size
// Querying the invitation target friend profile list
KGKakaoProfile.loadInvitableFriendProfiles(recommendLimit, offset, limit, new KGResultCallback<KGKakaoFriendsResponse>() {
@Override
public void onResult(KGResult<KGKakaoFriendsResponse> result) {
if (result.isSuccess()) {
// Query of invitation target friend profile list successful
KGKakaoFriendsResponse response = result.getContent();
// Number of KakaoTalk invitation target friends
int totalCount = response.getTotalCount();
// List of invitation target friend profiles
List<KGKakaoProfile> friendList = response.getFriendList();
for (KGKakaoProfile profile : friendList) {
// is recommended
boolean isRecommended = profile.isRecommended();
// Since the friend does not have a playerId before running the game, it can be managed by using KGKakaoProfile.getUUID().
String UUID = profile.getUUID();
}
} else {
// Query of invitation target friend profile list failed
}
}
}); |
iOS
#import <KakaoGame/KakaoGame.h>
// [TODO] Set limit of recommend friend
int recommendLimit = 5;
// [TODO] Set start value of friend list query
int offset = 0; // Friend list query start value
// [TODO] Set friend list query size
int limit = 300; // Friend list size
// Querying the invitation target friend profile list
[KGKakaoProfile loadInvitableFriendProfilesWithRecommendLimit:recommendLimit offset:offset limit:limit completionHandler:^(NSError *error, int totalCount, NSArray *idpProfiles) {
if (IS_SUCCESS(error) == YES)
{
// Query of invitation target friend profile list successful
// Number of KakaoTalk invitation target friends
int _totalCount = totalCount;
// List of invitation target friend profiles
for(KGKakaoProfile *kakaoProfile in idpProfiles)
{
// is recommended
BOOL isRecommended = kakaoProfile.isRecommended;
// Since the friend does not have a playerId before running the game, it can be managed by using KGKakaoProfile.uuid.
NSString* uuid = kakaoProfile.uuid;
}
}
else
{
// Query of invitation target friend profile list failed
}
}]; |
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
Android
iOS