21.1 KakaoTalk Friend Picker Invitation Example
21.1. KakaoTalk Friend Picker Invitation Example
Caution
Do not mix with existing APIs under 3.12.0.
21.1.1. Invite as Single Picker
This is an example of inviting friends using a single picker.
Unity
using Kakaogame.SDK;
using Kakaogame.SDK.Kakao;
// [TODO] Set whether to display as a pop-up window
bool isPopup;
// [TODO] Set templateId
string templateId;
// [TODO] Setting the parameters set in the message template
Dictionary<string, object> argumentDic = new Dictionary<string, object>();
// Invite as single picker
KGKakaoPicker.SendSingleInviteMessage(isPopup, templateId, argumentDic, (result, user) => {
if (result.isSuccess)
{
// Request success
}
else
{
// Request failed
if (result.code == KGResultCode.MessageSettingDisabled)
{
// If the recipient has set up unsubscribe from messages.
}
else if (result.code == KGResultCode.ExceedDailyUsage)
{
// Occurs when one person exceeds the daily quota (regardless of recipient) that can be sent for a particular app.
}
else if (result.code == KGResultCode.ExceedMonthlyUsage)
{
// Occurs when the monthly quota that one person can send to a specific person for a specific app is exceeded.
}
else if (result.code == KGResultCode.NotKakaoTalkUser)
{
// The logged in user is not a 'KakaoTalk' user.
}
else
{
// Other errors
}
}
}); |
Android
import com.kakaogame.KGKakaoPicker;
import com.kakaogame.KGKakaoPicker.KGKakaoUser;
import com.kakaogame.KGResult;
import com.kakaogame.KGResultCallback;
// [TODO] Set whether to display as a pop-up window
int isPopUp;
// [TODO] Set templateId
String templateId;
// [TODO] Setting the parameters set in the message template
String nickname = ((KGKakaoProfile) KGLocalPlayer.getCurrentPlayer().getIdpProfile()).getNickname();
Map<String, String> args = new LinkedHashMap<String, String>();
args.put("${sender_name}", nickname);
// Invite as single picker
KGKakaoPicker.sendSingleInviteMessage(activity, isPopUp, templateId, args, new KGResultCallback<KGKakaoUser>() {
@Override
public void onResult(KGResult<KGKakaoUser> result) {
if (result.isSuccess()) {
// Request success
} else {
// Request failed
if (result.getCode() == KGResult.KGResultCode.MESSAGE_SETTING_DISABLE) {
// If the recipient has set up unsubscribe from messages.
} else if (result.getCode() == KGResult.KGResultCode.EXCEED_DAILY_USAGE) {
// Occurs when one person exceeds the daily quota (regardless of recipient) that can be sent for a particular app.
} else if (result.getCode() == KGResult.KGResultCode.EXCEED_MONTHLY_USAGE) {
// Occurs when the monthly quota that one person can send to a specific person for a specific app is exceeded.
} else {
// Other errors
}
}
}
}); |
iOS
#import <KakaoGame/KakaoGame.h>
#import <KakaoGameKakao/KakaoGameKakao.h>
// [TODO] Set whether to display as a pop-up window
BOOL isPopup;
// [TODO] Set templateId
NSString *templateId;
// [TODO] Setting the parameters set in the message template
NSDictionary *argumentDic = [NSDictionary dictionary];
// Invite as single picker
[KGKakaoPicker sendSingleInviteMessageWithIsPopup:isPopup templateId:templateId argumentDic:argumentDic completionHandler:^(NSError *error, KGKakaoUser *user) {
if (IS_SUCCESS(error))
{
// Request success
}
else
{
// Request failed
if (error.code == KGErrorMessageSettingDisabled)
{
// If the recipient has set up unsubscribe from messages.
}
else if (error.code == KGErrorExceedDailyUsage)
{
// Occurs when one person exceeds the daily quota (regardless of recipient) that can be sent for a particular app.
}
else if (error.code == KGErrorExceedMonthlyUsage)
{
// Occurs when the monthly quota that one person can send to a specific person for a specific app is exceeded.
}
else if (error.code == KGErrorKakaoTalkNotInstalled)
{
// The logged in user is not a 'KakaoTalk' user.
}
else
{
// Other errors
}
}
}); |
Unreal
21.1.2. Invite as Multi Picker
This is an example of inviting friends using the multi-picker.
In the case of multi-picker, if at least one person sending the invitation message is successful, it is returned as success.
Unity
Android
iOS
Unreal