HomeDocs
Skip to main content

dlt.getCountryInfo

Introduction​

Get country information based on SIM or language.

Usage Limitations​

Supported from basic library version 3.0.0 or higher.

Parameters​

Object object

AttributeTypeDefaultRequiredDescription
typestringYesPossible values: 'sim', 'language'
successfunctionNoCallback function for successful API call
failfunctionNoCallback function for failed API call
completefunctionNoCallback function for API call completion

Note: If the type parameter does not meet the requirements, the default logic will be used. The default logic is as follows: try to get SIM information first, and if not available, retrieve information based on language.

Return Value​

AttributeTypeDescription
countryCodestringCountry
mccstringCountry code
mncstringNetwork code
sourcestringSource, 'sim', 'language'
successstringtrue - setting successful
false - setting failed

Example Code​

// pages/index/index.js
Page({
getCountryInfo() {
dlt.getCountryInfo({
type: 'sim',
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.