Subscription API

Introduction

The Subscription APIs could know whether the user is a subscriber. Through the APIs, developer could provide some different specific services for the subscriber if needed.

Note

Subscription APIs are supported on PC and Mobile platforms.

Function Spec

void IsReady(StatusCallback callback)

API Paramters:

Name Class Description
callback StatusCallback callback function

for Unity

SubscriptionStatus GetUserStatus();

API Return: SubscriptionStatus

Value Description
Platforms Platforms that the user has subscribed, such as Windows or Android.
Type The user’s Transaction Type in VIVEPORT INFINITY.

Platforms: enum

Value Description
Windows The user is a Windows subscriber in VIVEPORT.
Android The user is a Android subscriber in VIVEPORT.

Type: enum

Value Description
UNKNOWN If the user is not a subscriber of any platforms. This value will be UNKNOWN.
PAID This user is a paid subscriber
REDEEM This user is a redeem subscriber
FREE_TRIAL This user is a freetrial subscriber

for Unreal

bool IsWindowsSubscriber();

API Return: bool

Value Description
true The user is a Windows subscriber in VIVEPORT.
false The user is NOT a Windows subscriber.
bool IsAndroidSubscriber();

API Return: bool

Value Description
true The user is a Android subscriber in VIVEPORT.
false The user is NOT a Android subscriber.
SubscriptionTransactionType IsAndroidSubscriber();

API Return: SubscriptionTransactionType

Value Description
UNKNOWN If the user is not a subscriber of any platforms. This value will be UNKNOWN.
PAID This user is a paid subscriber
REDEEM This user is a redeem subscriber
FREE_TRIAL This user is a freetrial subscriber

Details

How to get a VIVEPORT ID and VIVEPORT key

  • Please correctly paste the VIVEPORT ID and VIVEPORT KEY of the content into your code snipped through Copy VIVEPORT ID and Copy VIVEPORT KEY buttons on the Manage -> VIVEPORT Listing page of developer console.

    _images/AppID.png

Error code

Error Code Description & Trouble Shooting
0 Success, no error
50001 Invalid account id/VIVEPORT id/VIVEPORT key
50004 Cannot connect server
80002 GetLicense is failed because user does not login VIVEPORT

Best Practice

Attention

  • To get VIVEPORT ID and VIVEPORT Key correctly from the VIVEPORT developer console.
  • To use Top Level API - Viveport.Api.Init to initialize VIVEPORT platform. For Unity developer, it is usually used in MonoBehaviour “Start()”.
  • To use Subscription API - Viveport.Subscription.IsReady to ensure the connection is successfully established with VIVEPORT platform.
  • To use Subscription API - Viveport.Subscription.IsWindowsSubscriber to get whether the user is a Windows subscriber in VIVEPORT INFINITY.
  • To use Subscription API - Viveport.Subscription.IsAndroidSubscriber to get whether the user is a Android subscriber in VIVEPORT INFINITY.
  • To use Subscription API - Viveport.Subscription.SubscriptionTransactionType to ensure the user’s Transaction Type in VIVEPORT INFINITY.
  • To use Top Level API - Viveport.Api.Shutdown to shutdown and release VIVEPORT SDK resources. For Unity developer, it is usually used in MonoBehaviour “OnDestroy()” or before Application.Quit().

Before testing

  • Go to VIVEPORT website and download VIVEPORT desktop application.

    _images/Viveport_home.png
  • Install the downloaded file ViveportSetup.exe and follow the step by step to complete the setup process.

  • On the PC desktop, a VIVEPORT icon will be there. Double click to launch it and sign in as your developer account.

    _images/viveport_desktop_icon.png

Important

You could also see the Error Codes and Trouble Shooting pages to know what to do when you got problems using the VIVEPORT SDK.

Sample Code

Unity / Unreal