22.1 Reward Invitation(beta) Example
22.1. Reward Invitation(beta) Example
Do not mix with new 3.9.0 or higher APIs.
22.1.1. Querying ongoing reward invitation event list
This section shows an example of a query of the ongoing 'reward invitation event list.
Unity Example
using KakaoGame.SDK;
using KakaoGame.SDK.Kakao;
KGKakaoInvitationEvent.LoadInvitationEvents(
(result, events) => {
if (result.isSuccess) {
// Successful invitation event list lookup
foreach (var ev in events) {
int eventId = ev.eventId;
bool isEventCardEnabled = ev.isEventCardEnabled; // Whether to show event cards
long startTime = ev.startTime; // Event start time
long endTime = ev.finishTime; // Event end time
int maxHostRewardCount = ev.maxHostRewardCount; // Maximum number of rewards the invitees can receive
string hostRewardCode = ev.hostRewardCode; // The code of the reward item that the invitee receives
string joinerRewardCode = ev.joinRewardCode; // The code of the reward item that the participant receives
string invitationUrl = ev.invitationUrl; // Invitation URL. You must enter this when sending an invitation message.
int totalJoinerCount = ev.totalJoinerCount; // The number of people who have participated in my invite so far
}
}
else {
// Fail invitation event list lookup
}
}); |
Android Example
// query of the ongoing 'reward invitation event list.
KGKakaoInvitationEvent.loadInvitationEvents(new KGResultCallback<List<KGKakaoInvitationEvent>>() {
@Override
public void onResult(KGResult<List<KGKakaoInvitationEvent>> result) {
if (result.isSuccess()) {
// Successful invitation event list lookup
List<KGKakaoInvitationEvent> invitationEventList = result.getContent(); // ongoing 'reward invitation event list
for (KGKakaoInvitationEvent invitationEvent : invitationEventList) {
int eventId = invitationEvent.getEventId();
boolean isEventCardEnabled = invitationEvent.isEventCardEnabled();
long startTime = invitationEvent.getStartTime();
long finishTime = invitationEvent.getFinishTime();
int maxHostRewardCount = invitationEvent.getMaxHostRewardCount();
String hostRewardCode = invitationEvent.getHostRewardCode();
String joinRewrdCode = invitationEvent.getJoinRewardCode();
String invitationUrl = invitationEvent.getInvitationUrl();
int totalJoinerCount = invitationEvent.getTotalJoinerCount();
}
} else {
// Fail invitation event list lookup
}
} |
iOS Example
#import <KakaoGame/KakaoGame.h>
[KGKakaoInvitationEvent loadInvitationEventsWithCompletionHandler:^(NSError *error, NSArray *invitationEvents) {
if (IS_SUCCESS(error) == YES)
{
// Successful invitation event list lookup
// ongoing 'reward invitation event list
for (KGKakaoInvitationEvent *invitationEvent in invitationEvents)
{
int eventId = invitationEvent.eventId; // Event ID
bool isEventCardEnabled = invitationEvent.isEventCardEnabled; // Whether to show event cards
long long startTime = invitationEvent.startTime; // Event start time
long long finishTime = invitationEvent.finishTime; // Event end time
int maxHostRewardCount = invitationEvent.maxHostRewardCount; // Maximum number of rewards the invitees can receive
NSString *hostRewardCode = invitationEvent.hostRewardCode; // The code of the reward item that the invitee receives
NSString *joinRewardCode = invitationEvent.joinRewardCode; // The code of the reward item that the participant receives
NSString *invitationUrl = invitationEvent.invitationUrl; // Invitation URL. You must enter this when sending an invitation message.
int totalJoinerCount = invitationEvent.totalJoinerCount; // The number of people who have participated in my invite so far
}
}
else
{
// Fail invitation event list lookup
}
}]; |
22.1.2. Querying user who invited you
This section shows an example of a query of the user who invited you.
Unity Example
Android Example
iOS Example
22.1.3. View a list of players who have participated in my invitation
This section shows an example of a query of View a list of players who have participated in my invitation.
Unity Example
Android Example
iOS Example
22.1.4. Send invitation message with Kakao Talk
This is an example of sending an invitation message to KakaoTalk.
By default, this is the same as sending a regular invitation, but you must use the templateId for compensating invites and add an invitation_event_id.
(Guide : 20. Kakaotalk Message Template V2)
Unity
Android
iOS