supersdk

文档中心

文档中心

下载文档

Tool module integration document

General interface

The tool module provides some auxiliary features.

Get the device ID (new vision)

Interface Description: Get the new version of mobile device ID. The interface returns androidid for overseas game, and it returns imei number for domestic games , if it can not get imei number, then it returns androidid. This is added in SuperSDK4.1.0.1.iOS: idfa is returned first, idfv is not returned, and SuperSDK4.1.0.1 is added. Interface invoke:

Interface description:Get device ID 
string deviceIdNew = SuperSDK.getInstance().InvokeString(SuperSDKTools.MODULE_NAME, "getNewDeviceId", null);
Debug.Log("deviceId :" + deviceIdNew);

Log printing:

deviceId: 879a24fd3f6ab532

Get Youzu ID

Interface description:Get device ID (default “0” if no value). Interface Call:

// Get youzuId 
NSString *youzuId = SuperSDK.getInstance().InvokeString(SuperSDKTools.MODULE_NAME, "getYouzuId", null);
Debug.Log("Obtained youzuId:" + youzuId);

Results example:

Obtained youzuId:05ef24ff0bc7e3ad674e4361dbed9032

Get ShuMei ID

Interface description:Get device ID (default “0” if no value). Interface Call:

// Get shumeiId 
NSString *shumeiId = SuperSDK.getInstance().InvokeString(SuperSDKTools.MODULE_NAME, "getShuMeiId", null);
Debug.Log("Obtained shumeiId" + shumeiId);

Results example:

Obtained shumeiId:20210818101630c127007baef1422bd05f898c875b36a701c6c34338b49285

Get collectionData

Interface invoke:

// 获取设备采集数据
string collectionData = SuperSDK.getInstance().InvokeString(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_GET_COLLECTION_DATA, null);
Debug.Log("collectionData  :" + collectionData );

Example of results:

collectionData :
{
    "device_name": "MengXianglu的iPhone 6S",
    "bundle_id": "com.uuzu.zctx",
    "idfv": "2141E006-E2CB-458B-8C38-0666694B6485",
    "os_version": "iOS10.3.2",
    "operator": "chinaMobile",
    "language": "zh",
    "device_type": "iPhone8,1",
    "network": "WIFI",
    "idfa": "CC16A139-73F6-4E37-9946-4839156C2EB9"
}

Obtain client IP information (currently only supports overseas online game channels)

Interface invoke:

// 获取客户端IP信息-目前只支持海外网游渠道
SuperSDK.getInstance().Invoke(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_GET_IPINFO, null);

Interface callback:

public void OnCallBack(string moduleName, string funcName, string result) {
    //调用接口异步监听结果。
    Debug.Log("---------------SuperSDK callback ---------------------");
    Debug.Log("moduleName:" + moduleName);
    Debug.Log("funcName:" + funcName);
    Debug.Log("result:" + result);
    if (SuperSDKTools.MODULE_NAME.Equals(moduleName) && SuperSDKTools.FUNC_GET_IPINFO.Equals(funcName)) {
            // 获取客户端IP信息的回调
        } else {
        }
    }
}

Log printing:

---------------SuperSDK callback ---------------------
moduleName:tools
funcName:getClientIPInfo
result:{
    "code": 1,
    "data": "{"status":1,"msg":"成功","data":{"ip":"61.174.15.230","country":"CN","continent":"AP"}}",
    "msg": "success"
}

Get the language of the current device

iOS:

Screenshot Android:

Screenshot

Interface invoke:

// 获取当前设备使用的语言
string language = SuperSDK.getInstance().InvokeString(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_GET_LANGUAGE, null);
Debug.Log("language :" + language );

Example of results:

language :zh

Get the country set of the current device

Interface invoke:

// 获取当前设备设置的国家
string country = SuperSDK.getInstance().InvokeString(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_GET_COUNTRY, null);
Debug.Log("country :" + country );

Example of results:

country :CN

Copy to clipboard

Interface invoke:

// 复制到剪切板
Dictionary<string, object> parametersDic = new Dictionary<string, object>();
parametersDic.Add(SuperSDKTools.KEY_VALUE, "测试复制文字");
SuperSDK.getInstance().Invoke(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_COPY_TOCLIPBOARD, parametersDic);

Pop-up orginal window

Interface description: pop-up prompt, divided into toast window(window that disappears immediately after pop-up), and dialog window (window with button, click to disappear) * Toast popup Screenshot

接口调用:

//不传入按钮,判断为toast框
Dictionary<string, object> parametersDic = new Dictionary<string, object>();
parametersDic.Add(SuperSDKTools.KEY_TOOLS_TITLE, "弹出toast框");//提示用,过一秒钟即会消失
SuperSDK.getInstance().Invoke(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_ALERT, parametersDic);
  • dialog弹窗,异步回调 按钮描述:可以显示若干按钮,按钮个数可变,按钮文字使用”|“分割。如需要两个按钮:确认、取消,则写成”确认|取消”。三个按钮:”确认|中立|取消”

Screenshot 接口调用:

// 弹原生框
Dictionary<string, object> parametersDic = new Dictionary<string, object>();
parametersDic.Add(SuperSDKTools.KEY_TOOLS_TITLE, "可爱的小兵兵");
parametersDic.Add(SuperSDKTools.KEY_TOOLS_CONTENT, "小兵小兵,上楼梯");
parametersDic.Add(SuperSDKTools.KEY_TOOLS_BUTTON, "确认|取消");
SuperSDK.getInstance().Invoke(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_ALERT, parametersDic);

Interface callback:

public void OnCallBack(string moduleName, string funcName, string result)
{
     Debug.Log("---------------SuperSDK callback ---------------------");
     Debug.Log("moduleName:" + moduleName);
     Debug.Log("funcName:" + funcName);
     Debug.Log("result:" + result);
}

Log printing:

---------------SuperSDK callback ---------------------
 moduleName : tools,
 funcName : alert,
 result: {
  "msg" : "操作成功",
  "data" : "确定",
  "code" : 1
}

Set screen brightness

Interface invoke:

// 设置屏幕亮度方法
double light = 0.2;  //0 - 1之间
Dictionary<string, object> parametersDic = new Dictionary<string, object>();
parametersDic.Add(SuperSDKTools.KEY_VALUE, light);
SuperSDK.getInstance().Invoke(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_SET_SCREEN_LIGHT, parametersDic);

Write cache

Interface invoke:

// 写缓存
Dictionary<string, object> parametersDic = new Dictionary<string, object>();
parametersDic.Add(SuperSDKTools.KEY, "data");
parametersDic.Add(SuperSDKTools.KEY_VALUE, "xiaobing");
SuperSDK.getInstance().Invoke(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_SAVE_DATA, parametersDic);

Read cache

Interface invoke:

// 读取缓存
Dictionary<string, object> parametersDic = new Dictionary<string, object>();
parametersDic.Add(SuperSDKTools.KEY, "data");
Debug.Log("getData :" + SuperSDK.getInstance().InvokeString(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_GET_DATA, parametersDic));

Log printing

getData :xiaobing

获取应用包名

Screenshot Screenshot Interface invoke:

// 获取应用包名
string packageName =  SuperSDK.getInstance().InvokeString(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_GET_PACKAGE_NAME, null);
Debug.Log("packageName :" + packageName );

Log printing:

//iOS
packageName :com.uuzu.zctx
//Android
packageName :com.youzu.supersdk.demo

Get app name

Screenshot

Interface invoke:

// 获取应用名称
string appName =  SuperSDK.getInstance().InvokeString(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_GET_APP_NAME, null);
Debug.Log("appName :" + appName );

Log printing:

//iOS
appName :母包Demo
//Android
appName :SuperSDKDemo

iOS-specific interface

Get short version

Screenshot Interface invoke:

// 获取short version方法
string shortVersion = SuperSDK.getInstance().InvokeString(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_GET_SHORT_VERSION, null);
Debug.Log("shortVersion:" + shortVersion);

Log printing:

shorVersion:4.0.0

Get build version

Interface invoke:

// 获取build version方法
string buildVersion = SuperSDK.getInstance().InvokeString(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_GET_BUILD_VERSION, null);
Debug.Log("buildVersion :" + buildVersion );

Log printing:

buildVersion :4.0.0

Get the string data corresponding to info.plist

Screenshot Interface invoke:

// 获取info.plist key对应的字符串数据
Dictionary<string, object> parametersDic = new Dictionary<string, object>();
parametersDic.Add(SuperSDKTools.KEY, "sp_version");                          };
string plistInfo =  SuperSDK.getInstance().InvokeString(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_GET_INFO_PLIST_VALUE, parametersDic);
Debug.Log("plistInfo :" + plistInfo );

Log printing:

plistInfo:4.0.0

Determine if the device is jailbroken

Interface invoke:

// Determine whether the device is jailbroken
bool isJaibreak = SuperSDK.getInstance().InvokeBool(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_JAIBREAK, null);

Example of results:

false

Android-specific interface

Get versionName

Screenshot

Interface invoke:

// 获取versionName方法
string versionName= SuperSDK.getInstance().InvokeString(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_GET_VERSION_NAME, null);

Get versionCode

Screenshot

Interface invoke:

// 获取versionCode方法
int versionCode = SuperSDK.getInstance().InvokeInt(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_GET_VERSION_CODE, null);

Get Meta-data

Interface description: Get the value of the meta-data under AndroidManifest.

Screenshot

Interface invoke:

Dictionary<string, object> parametersDic = new Dictionary<string, object>();
parametersDic.Add(SuperSDKTools.KEY, "sp_version");                          };
string meta_value = SuperSDK.getInstance().InvokeString(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_GET_META_DATA, parametersDic);
Debug.Log("meta_value:" + meta_value);

Log printing

meta_value: 3.1.1

Appendix

Constant string Actual string Description
SuperSDKTools.MODULE_NAME tools Module name
SuperSDKTools.FUNC_GET_DEVICE_ID getDeviceId Get device ID
SuperSDKTools.FUNC_GET_COLLECTION_DATA getCollectionData Method of getting device data acquisition
SuperSDKTools.FUNC_JAIBREAK isJailBreak Method for judging whether a device is jailbroken
SuperSDKTools.FUNC_GET_IPINFO getClientIPInfo Get client IP information
SuperSDKTools.FUNC_GET_LANGUAGE getLanguage Get the language used by the current device
SuperSDKTools.FUNC_GET_COUNTRY getCountry Get the country set by the current device
SuperSDKTools.FUNC_COPY_TOCLIPBOARD copyToClipboard Copy to clipboard
SuperSDKTools.FUNC_ALERT alert Pop-up original window
SuperSDKTools.FUNC_SET_SCREEN_LIGHT setScreenLight Set screen brightness
SuperSDKTools.FUNC_SAVE_DATA saveData Write cache
SuperSDKTools.FUNC_GET_DATA getData Read cache
SuperSDKTools.FUNC_GET_PACKAGE_NAME getPackageName Get the application package name
SuperSDKTools.FUNC_GET_APP_NAME getAppName Get app name
SuperSDKTools.FUNC_GET_SHORT_VERSION getShortVersion Get the short version
SuperSDKTools.FUNC_GET_BUILD_VERSION getBuildVersion Get the build version
SuperSDKTools.FUNC_GET_VERSION_NAME getVersionName Get the version name
SuperSDKTools.FUNC_GET_VERSION_CODE getVersionCode Get the version code
SuperSDKTools.FUNC_GET_INFO_PLIST_VALUE getInfoPlistValue Get the data of converting info.plist to json string
SuperSDKTools.FUNC_GET_META_DATA getMetaData Get the android:value value of the meta-data corresponding to the key value in AndroidManifest.xml