What is ZAnti-AddictionSDK
For games released in China, one of the rules that must be followed is real-name authentication before playing and a limit on how long minors can play.
Using this sdk, you can easily implement this feature.
Platform
-
iOS
- Xcode 10 or higher
- iOS 10.0 or higher
-
CocoaPods
- Xcode 10 or higher
-
Android
- Not supported
The AntiAddictionSystem Unity plugin is distributed with the Unity Play Services Resolver library. This library is intended for use by any Unity plugin that requires access to Android specific libraries (e.g., AARs) or iOS CocoaPods. It provides Unity plugins the ability to declare dependencies, which are then automatically resolved and copied into your Unity project.
Detailed Steps
1. Download the Plugin
Or use the ZAnti-AddictionSDK.unitypackage file within the project
Import plugin
Open your project in the Unity editor.
Select Assets > Import Package > Custom Package and find the ZAnti-AddictionSDK.unitypackage file you downloaded.
Import
3. Build iOS Project
4. Run CocoaPods
After the build is completed, enter the project directory and execute pod install
This step depends CocoaPods
5. Necessary Configuration
info.plist
Add the following parameters into the info.plist.
You can find the info.plist in your Xcode project.
-
zgameid:You can contact PM for this -
zchannelid:You can contact PM for this
<key>zgameid</key>
<string>your game id</string>
<key>zchannelid</key>
<string>your channel id</string>
Capabilities - Sign In with Apple
In the project editor, add the Sign In with Apple capability to your target.
You might get the following error:
- "xxx" requires a provisioning profile with the Sign in with Apple feature.
- can't find Sign In with Apple in capability
It might have something to do with Certificates, Identifiers & Profiles,You can contact the PM to try to resolve the problem.
How to use
AntiAddictionSDK
using System;
using UnityEngine;
using AntiAddictionSDK.Api;
using AntiAddictionSDK.Common;
using AntiAddictionSDK;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class AASDKDemoScript: MonoBehaviour
{
AntiAddictionStytemSDK antiAddictionSDK;
public Text statusText;
// Start is called before the first frame update
void Start()
{
antiAddictionSDK = new AntiAddictionStytemSDK();
antiAddictionSDK.ZAASDKCompleted += HandleZAASDKCompleted;
}
// allback handlers
// Allow the game to start
public void HandleZAASDKCompleted(object sender, EventArgs args)
{
statusText.text = "HandleZAASDKCompleted";
print("AntiAddiction---HandleZAASDKCompleted");
}
}
Optional configuration
1. IDFA
Getting IDFA helps optimize the user experience.
Add the following parameters into the info.plist:
-
NSUserTrackingUsageDescription:get hint for IDFA
<key>NSUserTrackingUsageDescription</key>
<string>get hint for IDFA</string>
2. Change SDk Background Image
The current default screen is as follows: Portrait
LandscapeYou can replace the interface by adding images to the project like this:
Add an image resource and name it 'ZAA_Launch_Bg' to modify the portrait background image
Add an image resource and name it 'ZAA_Launch_Bg_H' to modify the Landscape background image
Add an image resource and name it 'ZAA_Launch_StartButton' to modify the Start button











