THIS DOCUMENT IS OBSOLETE. Please use “DRM UNITY INTEGRATION“
DRM – Android Integration
Document Revision: 24th December 2019
If you are using Unity 2018.2 or newer, please stick to a newer integration revision (link)
1. Construct a JSON object with the following parameters:
- pc = device serial number
- game = your SynthesisVR game id
- key = the game private key (request it via info@synthesisvr.com)
- type = android
- mac = the MAC address of the device
- package = your Android package name
To read the device serial number (the “pc” parameter):
- Java/Kotlin:
- import android.os.Build
- Build.SERIAL
- Unity:
AndroidJavaObject jo = new AndroidJavaObject("android.os.Build");
string serial = jo.GetStatic<string>("SERIAL");
To read the device MAC address:
- Kotlin:
fun getMacAddr(): String {
try {
val all = Collections.list(NetworkInterface.getNetworkInterfaces())
for (nif in all) {
if (!nif.getName().equals("wlan0", ignoreCase = true)) continue
val macBytes = nif.getHardwareAddress() ?: return ""val res1 = StringBuilder()
for (b in macBytes) {
res1.append(String.format("%02X:", b))
}if (res1.length > 0) {
res1.deleteCharAt(res1.length - 1)
}
return res1.toString().replace(":","")
}
} catch (ex: Exception) {
}return "00:00:00:00:00:00"
}
- Unity (C#):
- <Tons of good examples online>
Example JSON:
{
"pc": "1PASH9BLXC9144",
"game": 12345,
"key": "KKKKKKKKKKKKKKKK",
"type": "android",
"mac": "001122334455",
"package": "com.studio.game"
}
2. Perform HTTP POST to:
- https://api.synthesisvr.com/contentLicenseAuthentication
and use the JSON string as content for the HTTP POST BODY.
3. You’ll receive a JSON response containing a few simple parameters:
- status = 0|1 — integer value ; 0 means the game should immediately close ; 1 confirms the license status of the game instance and the game can launch
- msg = <status explanation> — a way to see what is wrong in the event of status=0
When status=1:
- expire = <double/float value> — points to an UTC epoch in the future. Normally, the DRM response can be cached locally on the device and reused until the given UTC epoch. The cache behavior is optional, but will ensure that the game can work offline for a certain time
- token = <string> — non-sense string. Will be used with further DRM improvements