Skip to main content
Version: 5.11.8

[deprecated] GetPolicy

public BackendReturnObject GetPolicy();

Note on GetPolicy method's migration to GetPolicyV2

Following the 2023.03.28 update, developers may now create up to 2 game operation policies.

Some return values have been changed to distinguish the values, and when migrating to GetPolicies, change the according to the following:

  • Before change: Backend.Policy.GetPolicy().GetReturnValuetoJSON()["terms"].ToString();
  • After change: Backend.Policy.GetPolicyV2().GetReturnValuetoJSON()["policy"]["terms"].ToString();

Description

This is a function to load the Terms of Service and Privacy Policy registered in BACKND Console.

Example

Synchronous

BackendReturnObject bro = Backend.Policy.GetPolicy();

string privacyUrl = bro.GetReturnValuetoJSON()["privacyURL"].ToString();

Asynchronous

Backend.Policy.GetPolicy((callback) =>
{
string privacyUrl = callback.GetReturnValuetoJSON()["privacyURL"].ToString();
});

SendQueue

SendQueue.Enqueue(Backend.Policy.GetPolicy, (callback) =>
{
string privacyUrl = callback.GetReturnValuetoJSON()["privacyURL"].ToString();
});

Return cases

Success cases

When loaded successfully
statusCode : 200

returnValue : refer to GetReturnValuetoJSON

When not registered
statusCode : 200

returnValue : {"terms":null,"termsURL":null,"privacy":null,"privacyURL":null}

GetReturnValuetoJSON

{
terms: "These are the Terms of Service", // The html file of Terms of Service below is parsed as a string and returned.
termsURL:"www.thebackend.io/terms.html",
privacy: "This is the privacy policy.", // The html file of the Privacy Policy below is parsed as a string and returned.
privacyURL:"www.thebackend.io/privacy.html"
}

Sample code

public class Policy
{
public string terms;
public string termsURL;
public string privacy;
public string privacyURL;
public override string ToString()
{
string str = $"terms : {terms}\n" +
$"termsURL : {termsURL}\n" +
$"privacy : {privacy}\n" +
$"privacyURL : {privacyURL}\n";
return str;
}
}
[TestMethod]
public void GetPolicy()
{
var bro = Backend.Policy.GetPolicy();
if(!bro.IsSuccess())
{
return;
}
Policy policy = new Policy();
policy.terms = bro.GetReturnValuetoJSON()["terms"].ToString();
policy.termsURL = bro.GetReturnValuetoJSON()["termsURL"].ToString();
policy.privacy = bro.GetReturnValuetoJSON()["privacy"].ToString();
policy.privacyURL = bro.GetReturnValuetoJSON()["privacyURL"].ToString();
Debug.Log(policy.ToString());
}