supersdk

文档中心

文档中心

下载文档

Tools Module


The tools module provides some help functions.

Get Device Collection Data

Interface Call:

// Get device collection data
NSString *collectionData = [SuperSDK invokeString:BCORE_MODULE_TOOLS funcName:BCORE_FUNC_GET_COLLECTIONDATA parameters:nil];
NSLog(@"Obtained device collection data:%@", collectionData);

Results example:

2017-06-30 14:39:42.192769+0800 Demo_Mubao[1550:420769] Obtained device collection data:{  "device_name" : "MengXianglu's iPhone 6S",  "bundle_id" : "com.uuzu.zctx",  "idfv" : "C277C7BB-68CC-4E61-B831-1A7B88A4CDCB",  "os_version" : "iOS10.3.2",  "operator" : "chinaMobile",  "language" : "zh",  "device_type" : "iPhone8,1",  "network" : "WIFI",  "idfa" : "CC16A139-73F6-4E37-9946-4839156C2EB9"}

Check Device Jailbreak Status

Interface Call:

// Check if device is jailbroken
BOOL isJaibreak = [SuperSDK invokeBool:BCORE_MODULE_TOOLS funcName:BCORE_FUNC_JailBreak parameters:nil];
NSLog(@"Jailbreak status:%@", isJaibreak?@"Yes":@"No");

Results example:

2017-06-30 14:40:17.906678+0800 Demo_Mubao[1550:420769] Jailbreak status:No

Get Client IP Info - Currently only support overseas online game channels

Interface Call:

// Obtain client IP information, currently only support overseas online game channels
[SuperSDK invoke:BCORE_MODULE_TOOLS funcName:BCORE_FUNC_GET_CLIENT_IP_INFO parameters:nil];

Interface Callback:

- (void)handlerCallback:(NSString *)moduleName funcName:(NSString *)funcName result:(NSString *)result {
    // Handling SuperSDK callback logic, note that all module callbacks are here.
    NSLog(@"****** Received Callback\n moduleName : %@,\n funcName : %@,\n result : %@", moduleName, funcName, result);
    
    // 1. Callback parameter parsing
    NSDictionary *retParam = nil;
    if (result) {
        NSData *jsonData = [result dataUsingEncoding:NSUTF8StringEncoding];
        if (jsonData) {
            retParam = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableLeaves error:nil];
        }
    }
    
    int code            = [[retParam objectForKey:@"code"] intValue];   // Status code
    NSString *msg       = [retParam objectForKey:@"msg"];               // Description
    
    // 2. Callback parameter decision
    if ([moduleName isEqualToString:BCORE_MODULE_TOOLS]){// Tools module callback
        if ([funcName isEqualToString:BCORE_FUNC_GET_CLIENT_IP_INFO]) {// Callback method to obtain client IP info
            NSDictionary *clientIPInfo = [retParam objectForKey:@"data"];// Callback data parameters
            NSLog(@"Obtained the client IP address %@", clientIPInfo);
        }
    }
}

Callback Log Print:

2017-06-30 17:09:28.147401+0800 Demo_Mubao[1715:456033] ****** Received Callback
 moduleName : tools,
 funcName : getClientIPInfo,
 result : {
  "code" : 1,
  "msg" : "Success",
  "data" : {
    "ip" : "61.220.34.108",
    "country" : "TW",
    "continent" : "AP"
  }
}

Screenshot

Get languages used by current device

Interface Call:

// Get languages used by current device
NSString *language = [SuperSDK invokeString:BCORE_MODULE_TOOLS funcName:BCORE_FUNC_GET_LANGUAGE parameters:nil];
NSLog(@"Obtained languages used by current device:%@", language);

Results example:

2017-06-30 14:41:13.885806+0800 Demo_Mubao[1550:420769] Obtained languages used by current device:zh

Get current device country setting

Interface Call:

// Get current device's country setting
NSString *country = [SuperSDK invokeString:BCORE_MODULE_TOOLS funcName:BCORE_FUNC_GET_COUNTRY parameters:nil];
NSLog(@"Obtained current device's country setting:%@", country);

Results example:

2017-06-30 14:41:28.701972+0800 Demo_Mubao[1550:420769] Obtained current device's country setting:CN

Copy to Clipboard

Interface Call:

// Copy to clipboard
[SuperSDK invoke:BCORE_MODULE_TOOLS funcName:BCORE_FUNC_CopyToClipboard parameters:nil];

Native Popup

Interface Call:

// Popup native popup window
NSDictionary *parameters = @{
                              BCORE_KEY_TOOLS_TIILE : @"Popup Title",
                              BCORE_KEY_TOOLS_CONTENT : @"Popup Content",
                              BCORE_KEY_TOOLS_BUTTON : @"Confirm|Cancel"// For multiple buttons, please order left to right, with "|" to separate buttons
                              };
[SuperSDK invoke:BCORE_MODULE_TOOLS funcName:BCORE_FUNC_ALERT parameters: parameters];

Interface Callback:

- (void)handlerCallback:(NSString *)moduleName funcName:(NSString *)funcName result:(NSString *)result {
    // Handling SuperSDK callback logic, note that all module callbacks are here.
    NSLog(@"****** Received Callback\n moduleName : %@,\n funcName : %@,\n result : %@", moduleName, funcName, result);
    
    // 1. Callback parameter parsing
    NSDictionary *retParam = nil;
    if (result) {
        NSData *jsonData = [result dataUsingEncoding:NSUTF8StringEncoding];
        if (jsonData) {
            retParam = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableLeaves error:nil];
        }
    }
    
    int code            = [[retParam objectForKey:@"code"] intValue];   // Status code
    NSString *msg       = [retParam objectForKey:@"msg"];               // Description
    
    // 2. Callback parameter decision
    if ([moduleName isEqualToString:BCORE_MODULE_TOOLS]){// Tools module callback
        if ([funcName isEqualToString:BCORE_FUNC_ALERT]) {// Click popup button callback
            NSString *buttonTitle = [retParam objectForKey:@"data"];// Callback data parameters
            NSLog(@"Clicked %@ button", buttonTitle);
        }
    }
}

Callback Log Print:

2017-06-27 19:33:37.036805+0800 origin[4801:1472735] ****** Received Callback
 moduleName : tools,
 funcName : alert,
 parameters : {
  "msg" : "Operation successful",
  "data" : "Confirm",
  "code" : 1
}

Setting Screen Brightness Method

Interface Call:

// Setting Screen Brightness Method
[SuperSDK invokeString:BCORE_MODULE_TOOLS funcName:BCORE_FUNC_SetScreenLight parameters:@{
                                                                                                  BCORE_KEY_TOOLS_VALUE : @(0.5)// Brightness range is 0.0-1.0
                                                                                                  }];

Write Cache

Interface Call:

// Write cache
NSDictionary *parameters = @{
                              BCORE_KEY_TOOLS_KEY : @"Saved data's key value",
                              BCORE_KEY_TOOLS_VALUE : @"Saved data's value value"
                              };
[SuperSDK invoke:BCORE_MODULE_TOOLS funcName:BCORE_FUNC_SAVE_DATA parameters:parameters];

Read Cache

Interface Call:

// Read cache
NSDictionary *parameters = @{
                              BCORE_KEY_TOOLS_KEY : @"Saved data's key value"
                              };
NSString *data = [SuperSDK invokeString:BCORE_MODULE_TOOLS funcName:BCORE_FUNC_GET_DATA parameters:parameters];

Get App Configuration

Screenshot

  • Get App Package name

Interface Call:

// Get App Package name
NSString *packageName = [SuperSDK invokeString:BCORE_MODULE_TOOLS funcName:BCORE_FUNC_GET_PACKAGE_NAME parameters:nil];
NSLog(@"Obtained app package name:%@", packageName);

Results example:

2017-06-30 14:42:23.022109+0800 Demo_Mubao[1550:420769] Obtained app package name:com.uuzu.mubao
  • Get App name

Interface Call:

// Get app name
NSString *appName = [SuperSDK invokeString:BCORE_MODULE_TOOLS funcName:BCORE_FUNC_GET_APP_NAME parameters:nil];
NSLog(@"Obtained app name:%@", appName);

Results example:

2017-06-30 14:43:07.739737+0800 Demo_Mubao[1550:420769] Obtained app name:Demo_Mubao
  • Get short version method

Interface Call:

// Get short version method
NSString *shortVersion = [SuperSDK invokeString:BCORE_MODULE_TOOLS funcName:BCORE_FUNC_GET_SHORT_VERSION parameters:nil];
NSLog(@"Obtained short version:%@", shortVersion);

Results example:

2017-06-30 14:43:52.460754+0800 Demo_Mubao[1550:420769] Obtained short version:4.0.0
  • Get build version method

Interface Call:

// Get build version method
NSString * buildVersion = [SuperSDK invokeString:BCORE_MODULE_TOOLS funcName:BCORE_FUNC_GET_BUILD_VERSION parameters:nil];
NSLog(@"Obtained build version:%@", buildVersion);

Results example:

2017-06-30 14:44:14.996553+0800 Demo_Mubao[1550:420769] Obtained build version:4.0.0

Get corresponding string data for info.plist key

Screenshot

Interface Call:

// Get corresponding string data for info.plist key
NSDictionary *parameters = @{
                              BCORE_KEY_TOOLS_KEY : @"sp_version"// A certain key of info.plist, such as sp_version
                              };
NSString *spVersion = [SuperSDK invokeString:BCORE_MODULE_TOOLS funcName:BCORE_FUNC_GET_INFO_PLIST_VALUE parameters:parameters];
NSLog(@"Device sp_version:%@", spVersion);

Results example:

2017-06-30 14:44:14.996553+0800 Demo_Mubao[1550:420769] Device sp_version:4.0.0

Popup App Store Rating window within App (supports iOS10+)

[SuperSDK invoke:BCORE_MODULE_TOOLS funcName:@"getStoreReview" parameters:nil];

Jump to App Store Rating Page from App

// value value:AppleId provided by Apple's App Store Connect backend, such as:“1538544451”
[SuperSDK invoke:BCORE_MODULE_TOOLS funcName:@"getAPPStoreReview" parameters:@{
                BCORE_KEY_TOOLS_VALUE : @"1538544451"}];

Get Device Information

Interface Call:

// Get device information
NSString * deviceInfo = [SuperSDK invokeString:BCORE_MODULE_TOOLS funcName:@"getDeviceInfo" parameters:nil];
NSLog(@"device information:%@", deviceInfo);

Results example:

2017-06-30 14:39:42.192769+0800 Demo_Mubao[1550:420769] 
device information:{  "fingerprint_id" : "",  "idfa" : "CC202B32-3F94-47DC-B0B3-B60036C5A97E",  "shumei_id" : "0",  "android_id" : "",  "google_id" : "",  "package_name" : "com.yoozoo.jp.ik",  "imei" : "",  "device_name" : "iPhone 12 Pro Max",  "idfv" : "CEBA047C-7020-4552-AF85-3B1BDC0F1937",  "client_id" : "000703dd32897d63d8010d70f4ad8a2c",  "youzu_id" : "404742e2e40822aceee35ab74bcedfe6",  "udid" : "0_413c476665378e8a60c4d24e143a254a413c4766_CC202B32-3F94-47DC-B0B3-B60036C5A97E"}
KEY Description
fingerprint_id Device Fingerprint ID
shumei_id Shumei ID
android_id Android ID
google_id Google ID
package_name Package Name
imei IMEI
device_name Device Name
youzu_id Youzu ID
client_id Device Fingerprint ID Mapping
idfv IOS-UUID
idfa IOS-Advertising Identifier
udid IOS-Device ID

Get Overseas Equipment Advertisement Information

Interface Call:

[SuperSDK invoke:BCORE_MODULE_TOOLS funcName:@"getDeviceCheckInfo" parameters:nil];

Results example:

2017-06-30 17:09:28.147401+0800 Demo_Mubao[1715:456033] ****** 收到回调
 moduleName : tools,
 funcName : getDeviceCheckInfo,
 result : {
  "code" : 1,
  "data":"{"ad_game_type":"","ad_name":"","is_ad_device":false}",
  "msg" : "Operation successful",
}

List of Auxiliary Constants

Constant String Actual String Description
BCORE_MODULE_TOOLS tools Tools Module Name
BCORE_FUNC_GET_DEVICEID getDeviceId Get Device ID Method
BCORE_FUNC_GET_COLLECTIONDATA getCollectionData Get Device Collection Data Method
BCORE_FUNC_JailBreak isJailBreak Determine Jailbreak Status Method
BCORE_FUNC_GET_CLIENT_IP_INFO getClientIPInfo Get Client IP Info Method
BCORE_FUNC_GET_LANGUAGE getLanguage Get Current Device’s Languages Method
BCORE_FUNC_GET_COUNTRY getCountry Get Current Device Country Setting Method
BCORE_FUNC_CopyToClipboard copyToClipboard Copy to Clipboard Method
BCORE_FUNC_ALERT alert Native Popup Method
BCORE_FUNC_SetScreenLight setScreenLight Set Screen Brightness Method
BCORE_FUNC_SAVE_DATA saveData Write Cache Method
BCORE_FUNC_GET_DATA getData Read Cache Method
BCORE_FUNC_GET_PACKAGE_NAME getPackageName Get App Package Name Method
BCORE_FUNC_GET_APP_NAME getAppName get App Name Method
BCORE_FUNC_GET_SHORT_VERSION getShortVersion Get short version Method
BCORE_FUNC_GET_BUILD_VERSION getBuildVersion Get build version Method
BCORE_FUNC_GET_INFO_PLIST_VALUE getInfoPlistValue Get info.plist converted to json string data method