Skip to main content
Version: 5.15.0

GetLatestVersion

public BackendReturnObject GetLatestVersion(); public BackendReturnObject GetLatestVersion(VersionInfo versionInfo);

Description

The latest version of information registered to the console is received.
This function is available on Android and iOS devices. In the editor, an error will be returned.

You can select Google Play Store, App Store, or One Store via VersionInfo.

Example

Synchronous

Backend.Utils.GetLatestVersion();
Backend.Utils.GetLatestVersion(VersionInfo.GooglePlayStore);

//Example(You can use the same logic asynchronously and in SendQueue.)
var bro = Backend.Utils.GetLatestVersion();
string version = bro.GetReturnValuetoJSON()["version"].ToString();
//If the version is up to date
if(version == Application.version)
{
return;
}

//If the app's current version and the version set in Version Management do not match
int forceUpdate = bro.GetReturnValuetoJSON()["type"].ToString();
if(forceUpdate == "1")
{
Debug.Log("Would you like to update? y/n");
}
else if(forceUpdate == "2")
{
Debug.Log("Update is required. Please proceed with the update in the store");

//Unity method that allows you to visit the app's store
#if UNITY_ANDROID
Application.OpenURL("market://details?id=" + Application.identifier);
#elif UNITY_IOS
Application.OpenURL("https://itunes.apple.com/kr/app/apple-store/" + "id1461432877");
#endif
}

Asynchronous

Backend.Utils.GetLatestVersion((callback) =>
{
// Post-process
});

Backend.Utils.GetLatestVersion(VersionInfo.AppStore, (callback) =>
{
// Post-process
});

SendQueue

SendQueue.Enqueue(Backend.Utils.GetLatestVersion, (callback) =>
{
// Post-process
});

SendQueue.Enqueue(Backend.Utils.GetLatestVersion, VersionInfo.OneStore, (callback) =>
{
// Post-process
});

ReturnCase

Success cases

When the lookup is successful
statusCode : 200
message : Success
returnValue : refer to GetReturnValuetoJSON

Error cases

When called in non-Android and non-iOS devices
errorCode : NotFoundException
message : Not Available OS

When the platform version is not registered
statusCode : 404
errorCode : NotFoundException
message : version not found, version cannot be found

GetReturnValuetoJSON

{
"version" : "1.0.0.1",
"type" : 1
}
typeDescription
1Optional update
2Forced update