21.1 KakaoTalk Invitation SDK Example
21.1. KakaoTalk Invitation SDK Example
- 1 21.1. KakaoTalk Invitation SDK Example
- 1.1 21.1.1. Querying ongoing invitation event list
- 1.2 21.1.2. Querying KakaoTalk Invitation Target List
- 1.3 21.1.3. Sending a KakaoTalk Invitation Message
- 1.4 21.1.4. Querying the number of friends I sent an invitation to
- 1.5 21.1.5. Querying the list of friends I sent an invitation to
- 1.6 21.1.6. Querying the count of players who invited you
- 1.7 21.1.7. Querying the list of players who invited you
Caution
Do not mix with existing APIs under 3.9.0.
In games newly released after 2022, you cannot use the Get Friends List and Send Message APIs guided below.
Please use the message sending function using the friend picker API.
21.1.1. Querying ongoing invitation event list
This section shows an example of a query of the ongoing invitation event list.
Unity 예제
using KakaoGame.SDK;
using KakaoGame.SDK.Kakao;
// query of the ongoing invitation event list.
KGKakaoInvitation.LoadEvents((result, events) => {
if (result.isSuccess)
{
// Successful invitation event list lookup
if (events != nil)
{
foreach (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 startTime = invitationEvent.startTime;
// Event end time
long finishTime = invitationEvent.finishTime;
// Event Description
string eventDescription = invitationEvent.eventDescription;
}
}
}
else if (result.code == KGResultCode.NotKakaoTalkUser)
{
// The user is not a KakaoTalk user.
}
else
{
// Fail invitation event list lookup
}
}); |
Android 예제
import com.kakaogame.KGKakaoInvitation;
import com.kakaogame.KGKakaoInvitation.KGKakaoEvent;
import com.kakaogame.KGResult;
// query of the ongoing invitation event list.
KGKakaoInvitation.loadEvents(new KGResultCallback<List<KGKakaoEvent>>() {
@Override
public void onResult(KGResult<List<KGKakaoEvent>> result) {
if (result.isSuccess()) {
// Successful invitation event list lookup
List<KGKakaoEvent> invitationEventList = result.getContent();
for (KGKakaoEvent invitationEvent : invitationEventList) {
// Event ID: Required when sending an invitation message, to retrieve a list of invitees or senders.
int eventId = invitationEvent.getEventId();
// Event start time
long startTime = invitationEvent.getStartTime();
// Event end time
long finishTime = invitationEvent.getFinishTime();
// Event Description
String description = invitationEvent.getEventDescription();
}
} else if (result.getCode() == KGResult.KGResultCode.NOT_KAKAOTALK_USER) {
// The user is not a KakaoTalk user.
} else {
// Fail invitation event list lookup
}
}
}); |
iOS 예제
#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
Windows Async
Unreal
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 예제
Android 예제
iOS 예제
Windows Sync
Windows Async
Unreal
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 예제
Windows Sync
Windows Async
Unreal
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 예제
Android 예제
iOS 예제
Windows Sync
Windows Async
Unreal
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 예제
Android 예제
iOS 예제
Windows Sync
Windows Async
Unreal
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 예제
Android 예제
iOS 예제
Windows Sync
Windows Async
Unreal
21.1.7. Querying the list of players who invited you
This section shows an example of a query the list of players who invited you.
Unity 예제
Android 예제
iOS 예제
Windows Sync
Windows Async
Unreal