Get Country and Region Information
methodName: getCountryInfo
Additional Parameters:
Property | Type | Required | Default Value | Description |
---|---|---|---|---|
type | String | Yes | Specify the type of country and region information to be obtained, primarily based on SIM or language. Note: If the type does not meet the requirements, the default logic will be used. The default logic is to first attempt to obtain information from the SIM, and if that is not available, it will fall back to the language-based method. - sim - language - Can be left empty (sim first, then language) |
Success Callback Function
Parameters
Object res
Property | Type | Description |
---|---|---|
countryCode | String | Country |
mcc | String | Country code |
mnc | String | Network code |
source | String | Source |
success | String | Describes whether the interface call was successful or not. "true" for success, "false" for failure |
Fail Callback Function
Parameters
Object res
Property | Type | Description |
---|---|---|
success | String | Describes whether the interface call was successful or not. "true" for success, "false" for failure |
errMsg | String | Error message |
Example Usage
const dlt = window['@transsion/byteh5bridge'];
const canCallDlt = dlt && window.dltms && window.dltms.isMiniShellGame();
if (canCallDlt) {
dlt.callApi('getCountryInfo', {
success: (res) => {
console.log('Success: ', res);
},
fail: (res) => {
console.log('Fail: ', res);
},
complete: (res) => {
console.log('Complete: ', res);
},
});
}