-
Notifications
You must be signed in to change notification settings - Fork 0
Home
This guide is intended for publishers who want to integrate the AntiAddictionSystem.
OS: Windows, Mac, Linux
Android SDK: > 4.4(API level 19)
IDE: Eclipse with ADT (ADT version 23.0.4) OR Android-Studio
Java: > JDK 7
add AntiAddictionSystem SDK adapters dependencies.
dependencies {
// AntiAddictionSDK
implementation "com.yumimobi.ads.sdk:antiaddiction:1.1.8"
}add maven central to project build.gradle
allprojects {
repositories {
mavenCentral()
maven { url 'https://repo1.maven.org/maven2/' }
}
}If your project turn on minifyEnabled, add the following to the proguard file.
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,*Annotation*,Synthetic,EnclosingMethod
-keep class com.zplay.android.addiction.prevention.** { *;}
loginCallback = new ZplayLoginCallback() {
@Override
public void loginSuccess(String uid, String token, String userName, String loginType) {
// Tells the delegate that user login success.
}
@Override
public void loginHasBeenShown() {
// Tells the delegate that a login view has been shown.
}
@Override
public void loginCancel() {
// Tells the delegate that a login view has been dismissed.
}
@Override
public void loginFail() {
// Tells the delegate that user login failed.
}
@Override
public void onSwitch() {
//switch login
}
};
userAuthVcCallback = new ZplayUserAuthVcCallback() {
@Override
public void userAuthVcHasBeenShown() {
// Tells the delegate that an auth view has been shown.
}
@Override
public void userAuthSuccess() {
// Tells the deledate that user auth success.
}
};
// Warning view callback
// You should listen to the following callbcaks and modify your app's UI logic.
warningCallback = new ZplayWarningCallback() {
@Override
public void warningHasBeenShown() {
// Tells the delegate that an warning view has been shown.
}
@Override
public void userClickLoginButtonInPayment() {
// Users cannot purchase in guest mode, so SDK will present a warning view.
// when user click the login button in warning view, you should show the login view.
// User can close the login view and continue the game.
}
@Override
public void userClickLoginButtonInNoTimeLeft() {
// [Important] Receive this callback means the user has been in the game as a guest for a long time
// [Important] SDK pops up a pop-up window for users to log in to continue or exit the game
// [Important] The game should requires the user to log in, and the APP should handle the logic that the user cannot continue the game without login.
}
@Override
public void userClickQuitButton() {
// Tells the delegate that user click the quit button in warning view.
}
@Override
public void userClickConfirmButton() {
// Tells the delegate that user click confirm button in warning view. , game does not need to be processed
}
};
ZplayAddictionSDK.init(Activity, loginCallback, userAuthVcCallback, warningCallback);Call this method when the app start. Make sure you call this method every time what app start.
ZplayAddictionSDK.showPrivacyPolicy(Activity, new ZplayPrivacyPolicyCallback() {
@Override
public void privacyPolicyShown() {
// Tells the delegate that a privacy policy view has been shown.
}
@Override
public void userAgreesToPrivacyPolicy() {
// Tells the delegate that the user has been agreed the private policy.
}
@Override
public void userDisagreesWithPrivacyPolicy() {
// Tells the delegate that the user has been disagrees the private policy.
}
});If your APP has no login function and no login interface, use the login function of the anti-addiction SDK to call this interface.
You only need to monitor loginSuccess (), loginFail () to determine whether the user has logged in successfully, and then execute the application logic.
ZplayAddictionSDK.login(Activity);If your APP has a login UI, just use our login interface
If the application uses the login interface designed by yourself. You can pass the account and password to the anti-addiction SDK by the following interface.
You only need to monitor loginSuccess (), loginFail () to determine whether the user has logged in successfully, and then execute the application logic.
//username:account
//password:password
ZplayAddictionSDK.loginWithUserName(Activity, userName, password);If your APP has access to WeChat SDK, QQ SDK, or the other SDK, you need to call this interface.
After login with Wechat or QQ, you can get one unique user ID. Then pass the unique ID to anti-addiction SDK by the following interface.
You should monitor loginSuccess (), loginFail () to determine whether the user has logged in successfully, and then execute the application logic.
//token: unique id return by other SDK
//otherID: unique id return by other SDK
//platformName: contact PM for this parameter
ZplayAddictionSDK.loginWithPlatformToken(Activity, token, otherID, platformName);If you use the SDK developed by Zplay, you can get a ZplayID after login. Pass the ZplayID to anti-addiction SDK.
//zplayID: return by zplay sdk.
ZplayAddictionSDK.loginWithZplayID(Activity, zplayId);Before Login success, user is in tourist mode. In this mode, you can show the auth view by following interface.
ZplayAddictionSDK.showVisitorUserAuthentication(Activity);If user can change account in your app, you should call the following interface before account changing.
ZplayAddictionSDK.logout(this, new ZplayLogoutCallback() {
@Override
public void logout(Activity activity) {
// Tells the delegate that user login out.
}
});According to Chinese regulations, there is a limit on the single payment amount and the cumulative monthly payment amount of minors in the game.
So before user payment, the interface checkNumberLimitBeforePayment() needs to be called.
If the user pays successfully, you should call reportNumberAfterPayment().
// payNumber: Payment amount, Unit penny
ZplayAddictionSDK.checkNumberLimitBeforePayment(Activity, payNumber, new ZplayCheckCallback() {
@Override
public void onCanPay() {
// Tells the delegate user can purchase in your app.
}
@Override
public void onProhibitPay(String errorMsg) {
// Tells the delegate user can't purchase in your app.
}
});// payNumber: Payment amount, Unit penny
ZplayAddictionSDK.reportNumberAfterPayment(Activity, payNumber);// notlogin: Unknow
// visitor: tourist mode
// user: regular user
String loginStatus = ZplayAddictionSDK.getLoginType(Activity);UserVerifiedType userAuthenticationIdentity = ZplayAddictionSDK.getUserVerified(MainActivity.this);
if(userAuthenticationIdentity == UserVerifiedType.UserAgeUnknow){
//unknow
}else if(userAuthenticationIdentity == UserVerifiedType.UserAdult){
//adult
}else{
//Under 18
}When the user presses the home button to exit the game to the background, please call the following interface
Warning: Call the following api when application will enter background.Not calling will cause the anti-addiction SDK to calculate the game time errorZplayAddictionSDK.onPause();ZplayAddictionSDK.onResume();