HomeDocs
Skip to main content

Get Country and Region Information

methodName: getCountryInfo​

Additional Parameters:​

PropertyTypeRequiredDefault ValueDescription
typeStringYesSpecify 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​

PropertyTypeDescription
countryCodeStringCountry
mccStringCountry code
mncStringNetwork code
sourceStringSource
successStringDescribes whether the interface call was successful or not. "true" for success, "false" for failure

Fail Callback Function​

Parameters​

Object res​

PropertyTypeDescription
successStringDescribes whether the interface call was successful or not. "true" for success, "false" for failure
errMsgStringError 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);
},
});
}
Privacy agreementDeveloper agreementcontact us: developer_private.mi@dlightek.com © 2024 MiniApp. All Rights Reserved.