71.1. Reach Kakao SDK Example
...
참고사항 |
---|
If you choose a way to authenticate at a certain point, you should implement it as shown below. Even if you choose to conduct authentication at the login time, if the user does not have a CI value, you can request authentication by calling this authentication API. If your game requires a purchase restriction with a CI value, be sure to call this API and check the CI value of the player before purchasingIn accordance with the Privacy Enhancement Policy, the CI values provided by the client SDK have been removed. For games that require purchase restrictions with CI values, call this API to check the information and get CI through the server API. |
Unity
코드 블럭 |
---|
// Request authentication
KGKakaoProfile.RequestAgeVerification((result) =>
{
if (result.isSuccess)
{
|
|
KGLocalPlayerlocalPlayer=KGLocalPlayer.currentPlayer; string ci=((KGKakaoProfile)localPlayer.idpProfile).ci; Save the If you limit your purchase with a CI value, |
|
onyourgame .It is usedidentifyuser as one personCI value.
}
else
{
// Fail
|
|
if(result.isSuccess)
{
KGLocalPlayer localPlayer = KGLocalPlayer.currentPlayer;
string ci = ((KGKakaoProfile)localPlayer.idpProfile).ci;
}
else
{
if ( if (result.code == KGResultCode.UnderAgePlayer)
|
|
// The user is underage. Show the message, call logout API and quit your game.
|
|
else // If personal authentication is mandatory, call this API again. |
|
}Android
코드 블럭 |
---|
// Request authentication
KGKakaoProfile.requestAgeVerification(activity, new KGResultCallback<Void>() {
@Override
public void onResult(KGResult<Void> result) {
if (result.isSuccess()) {
|
|
KGLocalPlayerlocalPlayer=KGLocalPlayer.getCurrentPlayer(); Stringci=((KGKakaoProfile)localPlayer.getIdpProfile()).getCI(); Save the If you limit your purchase with a CI value, |
|
onyourgame .Itis used identifyuser as one personCI value.
} else {
// Fail
if (result.getCode() == KGResult.KGResultCode.UDER_AGE_PLAYER) {
// The user is underage. Show the message, call logout API and quit your game.
} else {
// If personal authentication is mandatory, call this API again.
}
}
}
}); |
|
iOS
코드 블럭 |
---|
// Request authentication
[KGKakaoProfile requestAgeVerificationWithCompletionHandler:^(NSError *error) {
if (IS_SUCCESS(error))
{
|
|
KGLocalPlayer*localPlayer=[KGLocalPlayercurrentPlayer]; NSString*ci=((KGKakaoProfile *)localPlayer.idpProfile).ci;
// Save theyou limit your purchase with a CI value, |
|
onyour game.It isused identifyuser as one personCI value.
}
else
{
// Fail
if (error.code == KGErrorUnderAgePlayer)
{
// The user is underage. Show the message, call logout API and quit your game.
}
else
{
// If personal authentication is mandatory, call this API again.
}
}
}];
|
|
Unreal
코드 블럭 |
---|
#include "KakaoGame.h"
// Request authentication
FKGKakaoProfile::RequestAgeVerification(FKGResultDelegate::CreateLambda([=](FKGResult result) {
if (result.IsSuccess())
{
|
|
FKGIdpProfileidpProfile=FKGLocalPlayer::GetCurrentPlayer().GetIdpProfile(); FKGKakaoProfile*localKakaoProfile= (FKGKakaoProfile*)&idpProfile;
FString ci = localKakaoProfile->GetCI();
// Save the CI value on your game server. It is used to identify the user as one person // If you limit your purchase with a CI value, use the server API to obtain the CI value.
}
else
{
if (result.GetCode() == FKGResultCode::UnderAgePlayer)
{
// The user is underage. Show the message, call logout API and quit your game.
}
else
{
// If personal authentication is mandatory, call this API again.
}
}
})); |
|
71.1.2. Request In-Game Service Status
This API is Deprecated.
This is an example of requesting an in-game service status.
You can take the badge exposure information of WebView before calling InGame WebView and apply it to the UI.
Unity
코드 블럭 |
---|
// Request In-Game Service Status
KGKakaoInReachGameService.RequestIngameStatus((result, ingameStatus) =>
{
if (result.isSuccess)
{
// Before you launch In-game Webview, check whether you want to expose the new badge.
bool showNewBadge = ingameStatus.withGame.showNewBadge;
// This is the time when the new badge is activated. You can decide whether to be exposed according to your plan.
long lastModifiedAt = ingameStatus.withGame.lastModifiedAt;
// The URL of the Webview.
string homeUrl = ingameStatus.withGame.homeUrl();
}
else
{
// Fail...
}
}); |
|
Android
코드 블럭 |
---|
// Request In-Game Service Status
KGKakaoInReachGameService.requestIngameStatus(new KGResultCallback<KGIngameStatus>() {
@Override
public void onResult(KGResult<KGIngameStatus> result) {
if (result.isSuccess()) {
KGIngameStatus status = result.getContent();
// Before you launch In-game Webview, check whether you want to expose the new badge.
boolean showNewBadge = status.getWithGame().getShowNewBadge();
// This is the time when the new badge is activated. You can decide whether to be exposed according to your plan.
long lastModifiedAt = status.getWithGame().getLastModifiedAt();
// The URL of the Webview.
string homeUrl = status.getWithGame().getHomeUrl();
} else {
// Fail...
}
}
}); |
|
71.1.3. Exposure In-Game WebView
This API is Deprecated.
This is an example of exposing an in-game webview that exposes recommanded board games.
Unity
코드 블럭 |
---|
// Show In-game Webview
KGKakaoInReachGameService.ShowIngameWebView((result, integerResult) =>
{
if (result.isSuccess)
{
// Success
}
else
{
// Fail
}
}); |
|
Android
코드 블럭 |
---|
// Show In-game Webview
KGKakaoInReachGameService.showIngameWebView(new KGResultCallback<Integer>() {
@Override
public void onResult(KGResult<Integer> result) {
if (result.isSuccess()) {
// Success
} else {
// Fail
}
}
}); |
|
You can design the In-game Webview button to match the concept of your game and expose to the desired location.
...