Unreal
ViveportApiDemo.h
#include "Components/ActorComponent.h"
#include "ViveportApiDemo.generated.h"
#include "ViveportApi.h"
UCLASS( ClassGroup=(Viveport), meta=(BlueprintSpawnableComponent) )
class VIVEPORTSDK_API UViveportApiDemo : public UActorComponent
{
    GENERATED_BODY()
 public:
    // Sets default values for this component's properties
    UViveportApiDemo();
    // Called when the game starts
    void BeginPlay() override;
    // Called every frame
    void TickComponent(
                        float DeltaTime,
                        ELevelTick TickType,
                        FActorComponentTickFunction* ThisTickFunction
                      ) override;
    /** The VIVEPORT_ID for auth verify */
    FString VIVEPORT_ID = "bd67b286-aafc-449d-8896-bb7e9b351876";
    FString VIVEPORT_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDFypCg0OHf"
                         + "BC+VZLSWPbNSgDo9qg/yQORDwGy1rKIboMj3IXn4Zy6h6bgn"
                         + "8kiMY7VI0lPwIj9lijT3ZxkzuTsI5GsK//Y1bqeTol4OUFR+"
                         + "47gj+TUuekAS2WMtglKox+/7mO6CA1gV+jZrAKo6YSVmPd+o"
                         + "FsgisRcqEgNh5MIURQIDAQAB";
 private:
    // callback interface
    class MyInitCallback : public ViveportApiStatus
    {
    public:
        void OnSuccess(
            ) override;
        void OnFailure(int error_code
            ) override;
    };
    MyInitCallback myInitCallback;
    class MyShutdownCallback : public ViveportApiStatus
    {
    public:
        void OnSuccess(
            ) override;
        void OnFailure(int error_code
            ) override;
    };
    MyShutdownCallback myShutdownCallback;
};ViveportApiDemo.cpp
#include "ViveportSDKPrivatePCH.h"
#include "ViveportApiDemo.h"
UViveportApiDemo::UViveportApiDemo()
{
    // Set this component to be initialized when the game starts, and to be ticked every frame.  You can turn these features
    // off to improve performance if you don't need them.
    bWantsBeginPlay = true;
    PrimaryComponentTick.bCanEverTick = true;
}
// Called when the game starts
void UViveportApiDemo::BeginPlay()
{
    Super::BeginPlay();
    FString fstring = UViveportApi::Version();
    GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::White, fstring);
    UViveportApi::GetLicense(&myLicenseChecker, VIVEPORT_ID, VIVEPORT_KEY);
    UViveportApi::Init(&myInitCallback, VIVEPORT_ID);
}
void UViveportApiDemo::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
    Super::EndPlay(EndPlayReason);
    UViveportApi::Shutdown(&myShutdownCallback);
}
// Called every frame
void UViveportApiDemo::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
    Super::TickComponent( DeltaTime, TickType, ThisTickFunction );
}
void UViveportApiDemo::MyInitCallback::OnSuccess()
{
    FString fstring("Init success.");
    GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::White, fstring);
}
void UViveportApiDemo::MyInitCallback::OnFailure(int error_code)
{
    FString fstring = FString::Printf(TEXT("Init failure. error=%d"), error_code);
    GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::White, fstring);
}
void UViveportApiDemo::MyShutdownCallback::OnSuccess()
{
    FString fstring("Shutdown success.");
    GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::White, fstring);
}
void UViveportApiDemo::MyShutdownCallback::OnFailure(int error_code)
{
    FString fstring = FString::Printf(TEXT("Shutdown failure. error=%d"), error_code);
    GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::White, fstring);
}