dlt.getCountryByIso
Introduction
Gets the country ID of the phone's SIM card.
Usage Restrictions
Supported by the base library version 5.0.0 or higher.
Parameters
Object object
Attribute | Type | Default | Required | Description |
---|---|---|---|---|
success | function | No | Callback function for a successful request. | |
fail | function | No | Callback function for a failed request. | |
complete | function | No | Callback function for the end of a request. |
object.success Callback Function
Parameters
Object res
Attribute | Type | Description |
---|---|---|
success | string | Returns "true" if successful. |
countryCode | string | Country ID of the SIM card. |
object.fail Callback Function
Parameters
Object res
Attribute | Type | Description |
---|---|---|
success | string | Returns "false" in case of failed setting. |
Sample Code
// pages/index/index.js
Page({
getCountryByIso() {
dlt.getCountryByIso({
success: (res) => {
console.log('countryCode:', res.countryCode);
},
});
},
});