搜索结果
返回
最后更新时间: 2021-02-04 03:12:47 PM
The tool module provides some auxiliary features.
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:
//获取设备ID
string deviceIdNew = SuperSDK.getInstance().InvokeString(SuperSDKTools.MODULE_NAME, "getNewDeviceId", null);
Debug.Log("deviceId :" + deviceIdNew);
Log printing:
deviceId: 879a24fd3f6ab532
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"
}
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"
}
iOS:
Android:
Interface invoke:
// 获取当前设备使用的语言
string language = SuperSDK.getInstance().InvokeString(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_GET_LANGUAGE, null);
Debug.Log("language :" + language );
Example of results:
language :zh
Interface invoke:
// 获取当前设备设置的国家
string country = SuperSDK.getInstance().InvokeString(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_GET_COUNTRY, null);
Debug.Log("country :" + country );
Example of results:
country :CN
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);
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
接口调用:
//不传入按钮,判断为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);
接口调用:
// 弹原生框
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
}
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);
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);
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
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
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
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
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
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
Interface invoke:
// Determine whether the device is jailbroken
bool isJaibreak = SuperSDK.getInstance().InvokeBool(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_JAIBREAK, null);
Example of results:
false
Interface invoke:
// 获取versionName方法
string versionName= SuperSDK.getInstance().InvokeString(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_GET_VERSION_NAME, null);
Interface invoke:
// 获取versionCode方法
int versionCode = SuperSDK.getInstance().InvokeInt(SuperSDKTools.MODULE_NAME, SuperSDKTools.FUNC_GET_VERSION_CODE, null);
Interface description: Get the value of the meta-data under AndroidManifest.
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
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 |