SDK 초기화¶
Hive SDK 초기화는 SDK 기능 대부분을 초기화(initialization) 상태, 즉 사용 준비 상태로 만드는 것을 의미합니다. SDK 코드를 구현할 때에는 초기화를 가장 먼저 실행한 후에 Hive 기능 구현을 위한 메서드를 호출해야 합니다.
Note
기본 설정을 완료한 후에 Hive SDK를 초기화해야 합니다.
Note
다른 Hive SDK 기능과 달리 빌링은 자체적인 초기화가 필요합니다.
초기화 방법¶
Hive SDK를 초기화하려면 AuthV4.setup을 호출합니다. 초기화는 앱 실행 후 기업 로고(CI) 노출 후에 실행하는 것을 권장합니다. 콜백 메서드가 호출된 후 콜백 결과로 받은 result.isSuccess가 True이면 초기화에 성공한 것입니다. 다음은 예시 코드입니다.
API Reference: AuthV4.setup
using hive;
// Request Hive SDK Initialization
AuthV4.setup((result, isAutoSignIn, did, providerTypeList) => {
if (result.isSuccess()) {
// the initialization is successfully done. Handle login based on whether the auto-login is enabled or not.
} else if (result.needExit()) {
// TODO: Implement the termination of the app
// Users of the Cocos2d-x engine
// ex) exit(0);
// Unreal engine users
// Example) UKismetSystemLibrary::QuitGame(GetWorld(), nullptr, EQuitPreference::Quit, false);
} else {
// initialization failed
}
});
API Reference: AuthV4::setup
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
// Request Hive SDK Initialization
AuthV4::setup([=](ResultAPI const & result, bool isAutoSignIn, std::string did, std::vector<ProviderType> const & providerTypeList) {
if (result.isSuccess()) {
// the initialization is successfully done. Handle login based on whether the auto-login is enabled or not.
} else if (result.needExit()) {
// TODO: Implement the termination of the app
// Users of the Cocos2d-x engine
// ex) exit(0);
// Unreal engine users
// Example) UKismetSystemLibrary::QuitGame(GetWorld(), nullptr, EQuitPreference::Quit, false);
} else {
// initialization failed
}
});
API Reference: com.hive.AuthV4.setup
import com.hive.AuthV4;
// Request Hive SDK Initialization
AuthV4.setup(object: AuthV4.AuthV4SetupListener{
override fun onAuthV4Setup(result: ResultAPI, isAutoSignIn: Boolean, did: String?, providerTypeList: ArrayList<AuthV4.ProviderType>?) { if (result.isSuccess) {
// the initialization is successfully done. Handle login based on whether the auto-login is enabled or not.
} else if (result.needExit()) {
// TODO: Implement the termination of the app
// ex) exitProcess(0)
} else {
// initialization failed
}
}
})
API Reference: com.hive.AuthV4.setup
import com.hive.AuthV4;
// Request Hive SDK Initialization
AuthV4.setup(new AuthV4.AuthV4SetupListener() {
@Override
public void onAuthV4Setup(ResultAPI result, boolean isAutoSignIn, String did, ArrayList<AuthV4.ProviderType> providerTypeList) {
if (result.isSuccess()) {
// the initialization is successfully done. Handle login based on whether the auto-login is enabled or not.
} else if (result.needExit()) {
// TODO: Implement the termination of the app
// ex) System.exit(0);
} else {
// initialization failed
}
}
});
API Reference: HIVEAuthV4:setup
import HIVEService
// Request Hive SDK Initialization
AuthV4Interface.setup { (result, isAutoSignIn, did, providerTypeList) in
if result.isSuccess() {
// the initialization is successfully done. Handle login based on whether the auto-login is enabled or not.
} else if result.needExit() {
// TODO: Implement the termination of the app
// Example) exit(0)
} else {
// initialization failed
}
}
API Reference: HIVEAuthV4:setup
#import <HIVEService/HIVEService-Swift.h>
// Request Hive SDK Initialization
[HIVEAuthV4 setup:^(HIVEResultAPI *result, BOOL isAutoSignIn, NSString *did, NSArray<NSNumber *> *providerTypeList) {
if (result.isSuccess) {
// the initialization is successfully done. Handle login based on whether the auto-login is enabled or not.
} else if (result.needExit) {
// TODO: Implement the termination of the app
// ex) exit(0);
} else {
// initialization failed
}
}];
#include "HiveAuthV4.h"
FHiveAuthV4::Setup(FHiveAuthV4OnSetupDelegate::CreateLambda([this](const FHiveResultAPI& Result,
bool IsAutoSignIn,
const FString& Did,
const TArray<EHiveProviderType>& ProviderTypeArray)
{
if (Result.IsSuccess()) {
// 초기화 성공. 자동 로그인 가능 여부에 따라 로그인을 처리하세요.
} else if (Result.NeedExit()) {
// TODO: 앱 종료 기능을 구현하세요
// 예) UKismetSystemLibrary::QuitGame(GetWorld(), nullptr, EQuitPreference::Quit, false);
} else {
// 초기화 실패
}
}));
결과 콜백은 아래 정보를 포함합니다. 개발사는 아래 정보를 저장했다가 필요한 시점에 사용해야 합니다.
| 필드명 | 설명 | 예시 |
|---|---|---|
| isAutoSignIn | 자동 로그인 가능 여부 | true |
| did | 앱 설치 시 생성하는 앱 식별자로, 동일한 종류의 앱을 식별할 때 사용합니다. | 123456789 |
| providerTypeList | 현재 앱에서 제공하는 IdP 목록입니다. 명시적 로그인 커스터마이징 또는 IdP 연동 상태 정보를 구성할 때 필수로 사용합니다. | ProviderType.FACEBOOKProviderType.HIVE |
Note
Hive 콘솔 > 앱센터 > 프로젝트 관리에서 프로젝트 상태가 서비스 종료일 때 AuthV4.setup을 실행하면 에러 코드를 반환합니다.
초기화 결과¶
SDK 초기화는 다음을 수행합니다.
초기화 흐름¶
AuthV4.setup 실행 시 SDK가 내부적으로 실행하는 작업 흐름은 앱을 출시하려는 지역에 따라 다릅니다.
Warning
iOS 환경에서 Hive AdKit/Adiz을 사용 시 AdMob 콘솔에서 IDFA 설명 메시지를 만들고 앱 추적 투명성(App Tracking Transparency) 팝업을 노출할 수 있습니다. 이 경우 AdMob에서 앱 추적 투명성 팝업을 먼저 노출하므로, AuthV4.setup 흐름에서는 이 팝업을 노출하지 않습니다. 이는 위 3가지 출시 상황 모두에 해당합니다.
초기화 흐름: 기본 흐름¶
아래 이미지는 AuthV4.setup 실행 시 SDK가 내부적으로 실행하는 기본 작업 흐름입니다. 미국, 유럽을 제외한 기타 지역에 앱을 출시할 때에 해당합니다.
Note
iOS 팝업 노출 순서: 앱 추적 투명성 팝업 ➡ 약관 동의 팝업
초기화 흐름: 미국 출시¶
아래 이미지는 AuthV4.setup 실행 시 SDK가 내부적으로 실행하는 작업 흐름입니다. 미국에 앱을 출시할 때 COPPA(아동 온라인 개인정보 보호법)를 준수해야 하는 경우에 해당합니다.
Note
iOS 팝업 노출 순서: 약관 동의 팝업 ➡ 사용자가 약관 동의를 완료 ➡ 앱 추적 투명성 팝업
초기화 흐름: 유럽 출시¶
아래 이미지는 AuthV4.setup 실행 시 SDK가 내부적으로 실행하는 작업 흐름입니다. 유럽에 앱을 출시할 때 GDPR(일반 개인정보 보호법)을 준수해야 하는 경우에 해당합니다.
Note
iOS 팝업 노출 순서: 앱 추적 투명성 팝업 ➡ 약관 동의 팝업


