목차 | ||
---|---|---|
|
...
Initialization and Status Change Event Processing
...
SDK
...
Initialization
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTApplication; import com.kakaogame.KGTConfig; /** * 단일When using 앱으로a 사용하는single 경우app */ KGTConfig config = new KGTConfig(); config.setAppInfo( "909428", // appID "c3c38bbfa3828b342d946e9770c974d0", // appSecret "1.0.0", // appVersion "googlePlay", // market "14", // ageRating KGTServerType.QA, // server type KGTLogLevel.Error // log level ); /** * 앱When using 그룹을an 사용하는app 경우group */ Map<String, String> appsForAppGroup = new HashMap<>(); appsForAppGroup.put("909428", "c3c38bbfa3828b342d946e9770c974d0"); appsForAppGroup.put("921478", "5891c32124ca35821890a0bc1cec77a5"); KGTConfig config = new KGTConfig(); config.setAppGroupInfos( "tubeAppGroup", // appGroupId appsForAppGroup, // app info map "1.0.0", // appVersion "googlePlay", // market "14", // ageRating KGTServerType.QA, // server type KGTLogLevel.Error // log level ); KGTApplication.initSDK(this, config); |
...
Start
...
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTApplication; import com.kakaogame.KGTIdpProfile; import com.kakaogame.KGTPlayer; import com.kakaogame.KGTResult; KGTApplication.start(activity, null, result -> { if (result.isSuccess()) { // If 스타트가the 성공start 한is 경우successful // 자동로그인 여부 Check if auto-login is enabled boolean isLoggedIn = KGTPlayer.isLoggedIn(); if (isLoggedIn) { // 플랫폼에서The 발급한current 현재Player's Player의ID ID issued by the platform String playerId = KGTPlayer.getCurrentPlayer().getPlayerId(); // 플랫폼Platform access 액세스token 토큰(ZAT) String accessToken = KGTPlayer.getCurrentPlayer().getAccessToken(); // Retrieve 현재the current IDP 인증authentication 정보를 가져옴information KGTIdpProfile idpProfile = KGTPlayer.getCurrentPlayer().getIdpProfile(); // [TODO] 게임Move to 화면으로the 이동game 합니다screen. } else { // [TODO] 자동로그인이 안 된 경우 로그인 화면으로 이동 합니다If auto-login is not enabled, move to the login screen. } } else { // 스타트가If 실패the 한start 경우fails - 초기화가since 실패한initialization 경우failed, 이므로retry 스타트를the 재시도start 하거나or 앱을close 종료the 하여야 합니다app. int resultCode = result.getCode(); if (resultCode == KGTResult.KGTResultCode.NETWORK_FAILURE || resultCode == KGTResult.KGTResultCode.SERVER_TIMEOUT || resultCode == KGTResult.KGTResultCode.SERVER_CONNECTION_FAILED) { // [TODO] 네트워크 에러가 발생한 경우에는 유저에게 네트워크 이슈로 스타트에 실패했음을 알리고 재시도If a network error occurs, inform the user that the start failed due to a network issue and retry. } else { // [TODO] 나머지If 에러가other 발생한errors 경우에는occur, 에러provide 안내an 후error 스타트notification 재시도and 요청request 하여야a 합니다.retry -of 문제가 반복해서 발생하는 경우 에러코드 및 로그 확인 후 원인 파악이 필요합니다the start process. - If the issue persists, check the error code and logs to determine the cause. } } }); |
Pause
...
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTApplication; import com.kakaogame.KGTResult; KGTApplication.pause(activity, result -> { // }); |
Resume
...
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTApplication; import com.kakaogame.KGTResult; KGTApplication.resume(activity, result -> { if (result.isSuccess()) { // [TODO] If resume이resume 성공is 한successful, 경우resume 게임the 화면을game 재개합니다screen. } else { // [TODO] resume이If 실패resume 한fails, 경우navigate 인증to 실패the 면login 로그인 화면으로, 그외의 경우는 에러 팝업을 띄우고 재시도 여부를 확인합니다screen if it’s an authentication failure; otherwise, show an error popup and check if the user wants to retry. if (result.getCode() == KGTResult.KGTResultCode.AUTH_FAILURE || result.getCode() == KGTResult.KGTResultCode.IDP_AUTH_FAILURE) { // [TODO] 인증 실패의 경우 시작 화면으로 이동해서 다시 신규 로그인 flow를 수행합니다 In case of authentication failure, move to the start screen and perform the new login flow again. } else { // [TODO] 나머지If 에러가other 발생한errors 경우occur, 경우 에러 안내 후 resume 을 재시도 합니다. - 반복해서 문제가 발생하는 경우 앱을 종료하도록 합니다provide an error notification and request a retry of the start process. - If the issue persists, check the error code and logs to determine the cause. } } }); |
...
Adding a New Intent Receive Setting
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); // 현재 액티비티에 새로운 Update the current activity with the new intent 업데이트 this.setIntent(intent); } |
...
Login
...
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Logging In Without Using the Default Login UI
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTApplication; import com.kakaogame.KGTIdpProfile; import com.kakaogame.KGTPlayer; import com.kakaogame.KGTResult; // 로그인Set the 하고자IdpCode 하는for IdpCodethe 셋팅login KGTIdpProfile.KGTIdpCode code = KGTIdpCode.Kakao; // Log 특정in with idp로a 로그인specific 하기IDP KGTPlayer.login(activity, code, result -> { if (result.isSuccess()) { // IDP 로그인과login and 플랫폼platform 로그인login 성공succeeded // 플랫폼에서 발급한 현재 Player의 ID The current Player's ID issued by the platform String playerId = KGTPlayer.getCurrentPlayer().getPlayerId(); // 플랫폼Platform 액세스access 토큰token String accessToken = KGTPlayer.getAccessToken(); // 현재Retrieve the current IDP 인증authentication 정보를information 가져옴 KGTIdpProfile idpProfile = KGTPlayer.getCurrentPlayer().getIdpProfile(); // [TODO] 로그인 이 성공하였으므로 게임 화면으로 이동합니다 Since login was successful, proceed to the game screen. } else { // IDP 로그인login 혹은or 플랫폼platform 로그인login 실패failed // [TODO] 로그인If 실패login 시fails, 사용자inform 안내the 후user 재and 시도prompt 하도록them 하여야to 합니다retry. if (result.getCode() == KGTResult.KGTResultCode.NETWORK_FAILURE || result.getCode() == KGTResult.KGTResultCode.SERVER_TIMEOUT || result.getCode() == KGTResult.KGTResultCode.SERVER_CONNECTION_FAILED) { // [TODO] 네트워크If 에러가a 발생한network 경우에는error 로그인occurs, 재시도prompt 요청the 하여야 합니다user to retry logging in. } else if (result.getCode() == KGTResult.KGTResultCode.USER_CANCELED) { // [TODO] 사용자가 로그인 진행 중 취소한 상황이므로 로그인 화면을 유지 하여야 합니다Since the user canceled during the login process, the login screen should be maintained. } else if (result.getCode() == KGTResult.KGTResultCode.BLOCKED_BY_POLICY) { // [TODO] 차단당한 국가 코드 또는 IP 대역에서 로그인을 시도하였습니다. 이에 대한 처리가 필요합니다The login was attempted from a blocked country code or IP range. Handle accordingly. } else { // [TODO] 나머지If 에러가other 발생한errors 경우에는occur, 에러provide 안내 후 로그인 재시도 요청 하여야 합니다an error notification and prompt the user to retry logging in. - 에러코드 및 로그 확인 후 원인 파악이 필요합니다It is necessary to check the error code and logs to determine the cause. } } }); |
...
Logout
...
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Logging Out Without Using the Default Logout UI
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTPlayer; import com.kakaogame.KGTResult; // 로그아웃Logout 요청request KGTPlayer.logout(activity, false, result -> { if (result.isSuccess()) { // 로그아웃Logout 성공successful // [TODO] 시작 화면으로 돌아가기Return to the start screen } else { // 로그아웃Logout 실패failed } }); |
...
Unregistration
...
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Unregistering Without Using the Default Unregistration UI
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTPlayer; import com.kakaogame.KGTResult; // 탈퇴Unregister 요청request KGTPlayer.unregister(activity, false, result -> { if (result.isSuccess()) { // 탈퇴Unregistration 성공successful // [TODO] Return 시작to the 화면으로start 돌아가기screen } else { // 탈퇴Unregistration 실패failed } }); |
...
Account Linking
...
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
Linking Accounts Without Using the Default Account Linking UI
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTPlayer; import com.kakaogame.KGTIdpProfile; import com.kakaogame.KGTResult; // Set the 로그인IdpCode 하고자to 하는log IdpCodein 셋팅with KGTIdpProfile.KGTIdpCode code = KGTIdpCode.Kakao; // 특정Connect account idp로with 계정a 연결specific 하기idp KGTPlayer.connect(activity, code, result -> { if (result.isSuccess()) { // IDP 연결connection 성공successful // Player ID 는will 변경되지not 않습니다change. } else { // IDP 연결connection 실패failed if (result.getCode() == KGTResult.KGTResultCode.INVALID_PARAMETER) { // 잘못된Invalid 인자가 전달 된 경우parameter passed // 예)e.g., activity 가is null } else if (result.getCode() == KGTResult.KGTResultCode.NOT_AUTHORIZED) { // 현재The 인증이current 안되어state 있는is 경우not authorized } else if (result.getCode() == KGTResult.KGTResultCode.INVALID_STATE) { // 현재The 인증currently 된authenticated IDP 가is 기기not 인증이device 아닌authentication 경우 } else if (result.getCode() == KGTResult.KGTResultCode.ALREADY_USED_IDP_ACCOUNT) { // 이미The 인증되어account 있는is 계정인already 경우authenticated } else { // 기타Other 에러errors 발생occurred } } }); |
프로필
...
Profile
...
Retrieve My Information
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTPlayer; KGTPlayer localPlayer = KGTPlayer.getCurrentPlayer(); |
...
Retrieve My IDP
...
Information
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTPlayer; import com.kakaogame.KGTIdpProfile; KGTIdpProfile idpProfile = KGTPlayer.getCurrentPlayer().getIdpProfile(); |
시스템 정보
...
System Information
...
Retrieve Language Code
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTSystem; String languageCode = KGTSystem.getLanguageCode(); |
...
Retrieve Language Tag
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTSystem; String languageCode = KGTSystem.getLanguageTag(); |
...
Retrieve Country Code
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTSystem; String countryCode = KGTSystem.getCountryCode(); |
...
Retrieve IP-based Country Code
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTSystem; String countryCode = KGTSystem.getGeoCountryCode(); |
...
Retrieve Device ID
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTSystem; String deviceId = KGTSystem.getDeviceId(); |
...
Retrieve Device Model
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTSystem; String deviceModel = KGTSystem.getDeviceModel(); |
Retrieve OS
...
Name
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTSystem; String osName = KGTSystem.getOSName(); |
...
Retrieve Network Connection Status
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTSystem; boolean networkConnected = KGTSystem.isNetworkConnected(); |
...
Retrieve Connected Network Type
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTSystem; String networkType = KGTSystem.getNetworkType(); |
카카오 연동 기능
...
Kakao Integration Feature
...
Setting Up KakaoTalk Game Message Reception
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTKakaoTalk; // Display 카카오톡the view 게임to 메시지set 수신KakaoTalk 여부game 설정message 뷰reception 띄우기preferences KGTKakaoTalk.showSetting(activity, result -> { if (result.isSuccess()) { // Successfully 카카오톡set 게임the 메시지KakaoTalk 수신game 여부message 설정reception 성공settings boolean allowMessage = result.getContent(); // 설정된 메시지 수신 허용 여부 Whether message reception is allowed as per the settings } else if (result.getCode() == KGTResult.KGTResultCode.NOT_KAKAOTALK_USER) { // 로그인The 한logged-in 유저가 '카카오톡' 유저가 아닙니다. 카카오 스토리만 가입한 유저의 계정과 같이 카카오톡 유저가 아닌 경우user is not a 'KakaoTalk' user. This occurs when the user is only registered with KakaoStory and not KakaoTalk. } else { // 카카오톡 게임 메시지 수신 여부 설정 실패Failed to set the KakaoTalk game message reception settings } }); |
...
Retrieve KakaoTalk Profile
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTKakaoTalk; import com.kakaogame.KGTKakaoTalkProfile; // 카카오톡Retrieve 프로필KakaoTalk 조회하기profile KGTKakaoTalk.talkProfile(result -> { if (result.isSuccess()) { // 카카오톡Successfully 프로필retrieved 조회KakaoTalk 성공profile talkProfile = result.getContent(); // 로그인한 유저의 카카오톡 프로필 정보The KakaoTalk profile information of the logged-in user } else if (result.getCode() == KGTResult.KGTResultCode.NOT_KAKAOTALK_USER) { // 로그인 한 유저가 '카카오톡' 유저가 아닙니다. 카카오 스토리만 가입한 유저의 계정과 같이 카카오톡 유저가 아닌 경우The logged-in user is not a 'KakaoTalk' user. This occurs when the user is only registered with KakaoStory and not KakaoTalk. } else { // 카카오톡Failed to 프로필retrieve 조회KakaoTalk 실패profile } }); |
...
Retrieve KakaoTalk Game Friend List
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTKakaoTalk; import com.kakaogame.KGTKakaoFriendProfile; // 게임 친구 목록 조회하기Retrieve the list of game friends KGTKakaoTalk.friends(result -> { if (result.isSuccess()) { // 카카오톡Successfully 게임retrieved 친구KakaoTalk 목록game 조회friends 성공list. List<KGTPlayer> friendList = result.getContent(); // 게임Game 친구friends 목록list for (KGTPlayer player : friendList) { KGTKakaoFriendProfile kakaoProfile = (KGTKakaoFriendProfile)player.getIdpProfile(); } } else if (result.getCode() == KGTResult.KGTResultCode.NOT_KAKAOTALK_USER) { // 로그인 한 유저가 '카카오톡' 유저가 아닙니다. 카카오 스토리만 가입한 유저의 계정과 같이 카카오톡 유저가 아닌 경우. } The logged-in user is not a 'KakaoTalk' user. This occurs when the user is only registered with KakaoStory and not KakaoTalk. } else { // 카카오톡Failed to 게임retrieve 친구KakaoTalk 목록game 조회friends 실패list } }); |
...
Sending KakaoTalk Game Messages
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTKakaoFriendProfile; import com.kakaogame.KGTKakaoTalk; import com.kakaogame.KGTKakaoTalkProfile; // friendsFriend object API를retrieved 통해through 가져온the 친구friends 객체API KGTKakaoFriendProfile kakaoProfile; // 카카오Kakao profile 프로필(KGTKakaoFriendProfile 객체object) // [TODO] Set the 템플릿Template Id 설정 String templateId = ""; // [TODO] Set the 메시지arguments 템플릿에for 설정한the 인자message 설정template Map<String, String> args = new LinkedHashMap<>(); if (talkProfile != null) { args.put("${nickname}", talkProfile.getNickname()); } args.put("rog_link", "test=100&hello=20111"); args.put("bruce2", "test=100&hello=20111"); // 카카오톡Send 게임a 메시지KakaoTalk game 보내기message KGTKakaoTalk.sendGameMessage(kakaoProfile, templateId, args, result -> { if (result.isSuccess()) { // 카카오톡Successfully sent 채팅a 메시지KakaoTalk 보내기chat 성공message } else { if (result.getCode() == KGTResult.KGTResultCode.MESSAGE_SETTING_DISABLE) { // 받은이가 메시지 수신 거부를 설정한 경우The recipient has set message reception to disabled } else if (result.getCode() == KGTResult.KGTResultCode.EXCEED_DAILY_USAGE) { // 한명이 특정 앱에 대해 보낼 수 있는 하루 쿼터(받는 사람 관계없이) 초과시 발생 Occurs when the daily quota for sending messages to a specific app (regardless of the recipient) is exceeded. } else if (result.getCode() == KGTResult.KGTResultCode.EXCEED_MONTHLY_USAGE) { // 한명이Occurs 특정when 앱에the 대해monthly 특정인에게 보낼 수 있는 한달 쿼터 초과시 발생quota for sending messages to a specific person for a specific app is exceeded. } else { // 카카오톡Failed to 채팅send 메시지KakaoTalk 보내기chat 실패message } } }); |
...
Sending KakaoTalk Friend Invitation Messages
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTKakaoTalk; import com.kakaogame.KGTKakaoTalkProfile; import com.kakaogame.KGTKakaoUser; // [TODO] 팝업창으로 띄울지 여부 설정 Set whether to display as a popup window boolean isSingle = true; // [TODO] 팝업창으로Set 띄울지whether 여부to 설정display booleanas isPopup a popup window boolean isPopup = true; // [TODO] 템플릿Set the template Id 설정 String templateId = ""; // [TODO] Set 메시지the parameters 템플릿에for 설정한the 인자message 설정template Map<String, String> args = new LinkedHashMap<>(); if (talkProfile != null) { args.put("${nickname}", talkProfile.getNickname()); } KGTKakaoTalk.sendInviteMessage(activity, isSingle, isPopUp, templateId, args, result -> { if (result.isSuccess()) { // 카카오톡Successfully 초대sent 메시지KakaoTalk 보내기invite 성공message for (KGTKakaoUser kakaoUser : result.getContent()) { // 유저가 초대 메시지를 전송한 유저 목록 확인Check the list of users who received the invite message } } else { // 전부Failed 실패한to 경우(공통된send 원인to 리턴해주기all 필요) if (users (need to return a common cause) if (result.getCode() == KGTResult.KGTResultCode.MESSAGE_SETTING_DISABLE) { // The 받은이가recipient has 메시지set 수신message 거부를reception 설정한to 경우disabled } else if (result.getCode() == KGTResult.KGTResultCode.EXCEED_DAILY_USAGE) { // 한명이 특정 앱에 대해 보낼 수 있는 하루 쿼터(받는 사람 관계없이) 초과시 발생 Occurs when the daily quota for sending messages to a specific app (regardless of the recipient) is exceeded. } else if (result.getCode() == KGTResult.KGTResultCode.EXCEED_MONTHLY_USAGE) { // 한명이Occurs 특정when 앱에the 대해monthly 특정인에게 보낼 수 있는 한달 쿼터 초과시 발생quota for sending messages to a specific person for a specific app is exceeded. } else { // Failed 카카오톡to 초대send 메시지KakaoTalk 보내기invite 실패message } } }); |
...
Adding a KakaoTalk Channel
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTKakaoTalk; // [TODO] Set the 채널channel Id 설정 int channelId = 0; KGTKakaoTalk.addChannel(plusFriendId, result -> { if (result.isSuccess()) { // 채널Successfully added 추가the 성공channel } else if (result.getCode() == KGTResult.KGTResultCode.NOT_KAKAOTALK_USER) { // 로그인 한 유저가 '카카오톡' 유저가 아닙니다. 카카오 스토리만 가입한 유저의 계정과 같이 카카오톡 유저가 아닌 경우 The logged-in user is not a 'KakaoTalk' user. This occurs when the user is only registered with KakaoStory and not KakaoTalk. } else { // Failed 채널to add 추가the 실패channel } }); |
구글 게임
...
Retrieve the list of friends to whom I sent an invite message
발췌문 삽입 | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTGoogleGamesAchievementsKGTKakaoInvitation; // 구글 게임 업적 정보 화면 보여주기 KGTGoogleGamesAchievements.showAchievement(activity); |
업적 달성
...
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTPlayer; import com.kakaogame.KGTGoogleGamesAchievementsKGTKakaoFriendProfile; // [TODO] 업적Event 아이디Id. 설정int StringeventId id = ""0; // 업적Retrieve 달성 KGTGoogleGamesAchievements.unlock(id); |
업적 노출하기
...
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTGoogleGamesAchievements;
// [TODO] 업적 아이디 설정
String id = "";
KGTGoogleGamesAchievements.reveal(id); |
업적 단계 증가
...
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTGoogleGamesAchievements;
// [TODO] 업적 아이디 설정
String id = "";
int numSteps = 0;
KGTGoogleGamesAchievements.setSteps(id, numSteps); |
업적 단계 설정
...
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTGoogleGamesAchievements; // [TODO] 업적 아이디 설정 String id = ""; int numSteps = 0; KGTGoogleGamesAchievements.increment(id, numStepsthe list of friends to whom I sent an invite message. KGTKakaoInvitation.joiners(eventId, result -> { if (result.isSuccess()) { // Successfully retrieve the list of friends. // Retrieve the list of players I have invited. KGTKakaoInvitation.KGTInvitationJoinersResponse joinersResponse = result.getContent(); // List of players who have joined the app, including those who have left. List<KGTPlayer> joiners = joinersResponse.getPlayers(); if (joiners.isEmpty()) { // No users have joined the app. } else { // There are users who have joined the app. for (KGTPlayer player : joiners) { // Recipient’s player ID String playerId = player.getPlayerId(); KGTKakaoFriendProfile kakaoProfile = (KGTKakaoFriendProfile) player.getIdpProfile(); // Recipient’s nickname String nickname = kakaoProfile.getNickname(); // Recipient’s profile thumbnail image String thumbnailImageUrl = kakaoProfile.getThumbnailImageUrl(); // Recipient’s withdrawal history inquiry. Use the corresponding flag when displaying the withdrawal status information in the UI. boolean isUnregistered = kakaoProfile.isUnregistered(); } } } else if (result.getCode() == KGTResult.KGTResultCode.NOT_KAKAOTALK_USER) { // The logged-in user is not a 'KakaoTalk' user. This occurs when the user is only registered with KakaoStory and not KakaoTalk. } else { // Failed to retrieve the list of friends. } }); |
Retrieve the count of friends to whom I sent an invite message
발췌문 삽입 | ||||||||
---|---|---|---|---|---|---|---|---|
|
코드 블럭 | ||
---|---|---|
| ||
import com.kakaogame.KGTKakaoInvitation;
// [TODO] Event Id.
int eventId = 0;
KGTKakaoInvitation.receiversCount(eventId, result -> {
if (result.isSuccess()) {
// Successfully retrieve the count of friends to whom I sent an invite message.
// Retrieve the number of friends I have invited.
KGTInvitationReceviersCountResponse response = result.getContent();
int total = response.getTotalReceiversCount();
int joinersCount = response.getJoinersCount();
} else if (result.getCode() == KGTResult.KGTResultCode.NOT_KAKAOTALK_USER) {
// The logged-in user is not a 'KakaoTalk' user. This occurs when the user is only registered with KakaoStory and not KakaoTalk.
} else {
// Failed to retrieve the count of friends.
}
}); |