HaoYou quick explosion cloud archive SDK access document

edition

Update description

date

V1.0.0.0

1. Three functions: initialization archiving, gear selection and gear list

2021-12-24

  1. After downloading the SDK, download the common.sdk in the SDK package AAR and archives Aarcopy to the libs directory of your game project.
  2. In the project build Add the following code under the gradle file to complete the dependency,
   android {
    defaultConfig {
        //When the number of methods exceeds 65536, enable multi dex support
        multiDexEnabled true
    }
}

repositories {
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    //Introduce advertising SDK dependency
    implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])
}

Then synchronize the next gradle.

2. Access code

2.1 introduction to gamearchives databean data entity class

Field meaning

Field name

Optional

explain

Game ID

gameId

must

The cloud archive is the only character in the game access file. Use this ID to reference games saved in your game client.

User ID

userId

must

HykbUser obtained after successful login from HaoYou fast explosion anti addiction sdk or payment sdk

User login type

loginType

must

HykbUser obtained after successful login from HaoYou fast explosion anti addiction sdk or payment sdk

User token

token

must

HykbUser obtained after successful login from HaoYou fast explosion anti addiction sdk or payment sdk

Gear ID

archivesId

must

The gear ID provided by the game developer must be an integer

Gear title

archivesTitle

must

The archive Title provided by the game developer is a string with a length of no more than 30

Gear content

archivesContent

must

The content size of the archive Title provided by the game developer shall not exceed 1M

Gear time

updateTime

automatic

After successful archiving, this field is automatically generated by the server

For the above field content, set the value, such as setgameid ("111"), and get the value, such as getarchives content()

2.2 archiving

Access example:

GameArchivesDataBean dataBean = new GameArchivesDataBean();
dataBean.setGameId("game ID");
dataBean.setUserId("HaoYou quick explosion user ID");
dataBean.setLoginType("HaoYou quick explosion login type");
dataBean.setToken("OK, quick login token");
dataBean.setArchivesId(11);//Archive ID, integer, passed by the developer
dataBean.setArchivesTitle("Archive title");
dataBean.setArchivesContent("Archive content");
HykbGameArchives.saveArchivesData(SaveArchivesActivity.this, dataBean, new HykbSaveArchivesListener() {
                @Override
                public void onSuccess() {
                    //Archive successful
                }

                @Override
                public void onFailed(int code, String message) {
                    //Archiving failed. The reason for failure is in code and message
                    Log.i("archives","code = "+code+",message = "+message);
                }
            });

Interface method:

HykbGameArchives.saveArchivesData(Context context, GameArchivesDataBean bean, HykbSaveArchivesListener listener);

Parameter definition:

Parameter name

describe

context

ApplicationContext or Activity of the current application

bean

GameArchivesDataBean: entity object that archives data and parameters

listener

HykbSaveArchivesListener archive callback listening

2.3 gear taking

Access example:

GameArchivesDataBean dataBean = new GameArchivesDataBean();
dataBean.setGameId("game ID");
dataBean.setUserId("HaoYou quick explosion user ID");
dataBean.setLoginType("HaoYou quick explosion login type");
dataBean.setToken("OK, quick login token");
dataBean.setArchivesId(11);//Archive ID, integer, passed by the developer
HykbGameArchives.readArchivesData(SaveArchivesActivity.this, dataBean, new HykbReadArchivesListener() {
    @Override
    public void onSuccess(GameArchivesDataBean dataBean) {
        //Successful file retrieval
        StringBuilder sb = new StringBuilder();
        sb.append("file ID: ");
        sb.append(dataBean.getArchivesId());
        sb.append("\n");
        sb.append("Archive Title:");
        sb.append(dataBean.getArchivesTitle());
        sb.append("\n");
        sb.append("Archive content:");
        sb.append(dataBean.getArchivesContent());
        Log.i("archive", sb.toString());
    }

    @Override
    public void onFailed(int code, String message) {
        // Failed to retrieve the file. The failure reason is in code and message
        Log.i("archive","code = "+code+", message = "+message);
    }
});

Interface method:

HykbGameArchives.readArchivesData(Context context, GameArchivesDataBean bean, HykbReadArchivesListener listener);

Parameter definition:

Parameter name

describe

context

ApplicationContext or Activity of the current application

bean

GameArchivesDataBean: entity object that archives data and parameters

listener

Hykbreadarchivelistener fetching callback listening

2.4 obtaining the gear list

Access example:

GameArchivesDataBean bean = new GameArchivesDataBean();
bean.setGameId(gameId);
bean.setUserId(user.getUserId());
bean.setLoginType(user.getType());
bean.setToken(user.getToken());
HykbGameArchives.loadAllArchivesData(ArchivesListActivity.this, bean, new HykbLoadArchivesListener() {
            @Override
            public void onSuccess(List<GameArchivesDataBean> dataBean) {
                Log.i("archive","dataBean = "+dataBean.toString());
                // Successfully obtained gear list data
            }

            @Override
            public void onFailed(int code, String message) {
                // Failed to obtain the gear list. The failure reason is in code and message
                Log.i("archive","code = "+code+", message = "+message);
            }
        });

Interface method:

HykbGameArchives.loadAllArchivesData(Context context, GameArchivesDataBean bean, HykbLoadArchivesListener listener);

Parameter definition:

Parameter name

describe

context

ApplicationContext or Activity of the current application

bean

GameArchivesDataBean: entity object that archives data and parameters

listener

HykbLoadArchivesListener get gear list callback listening

Note: the archive list data has no file content, and developers need to obtain it according to the archive ID

2.5 code confusion

If you need to use proguard to confuse the code, make sure not to confuse the SDK code. Please visit Proguard Add the following configuration at the end of CFG file (or other confused files):

# Don't confuse listening
-keep class com.m3839.sdk.common.** {*;}
-keep class com.m3839.sdk.archives.** {*;}

2.6 code and message returned by interface status

code

message

101

Archive Title exceeds 30 characters

102

Network exception

103

Operation is too frequent (at present, the interval between archive, file reading and list request is 3s)

1001

Archive save failed

1101

Account information is invalid, please log in again

2001

Game archiving is not configured (currently, it can only be used after the game id is configured by the technology)

2002

Gear does not exist

2004

Archive content exceeds 1M

2005

A maximum of 10 gears can be stored

2101

Package body error (check whether the package name and signature are correct)

Added by sith717 on Fri, 21 Jan 2022 00:20:19 +0200