1e41f4b71Sopenharmony_ci# @ohos.telephony.sms (SMS) (System API) 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ciThe **sms** module provides basic SMS management functions. With the APIs provided by this module, you can create and send SMS messages, obtain the ID of the default SIM card used to send and receive SMS messages, and obtain and set the SMSC address. 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci>**NOTE** 6e41f4b71Sopenharmony_ci> 7e41f4b71Sopenharmony_ci>The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8e41f4b71Sopenharmony_ci> 9e41f4b71Sopenharmony_ci>This topic describes only system APIs provided by the module. For details about its public APIs, see [@ohos.telephony.sms (SMS)](js-apis-sms.md). 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ci## Modules to Import 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_ci```ts 15e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 16e41f4b71Sopenharmony_ci``` 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_ci## sms.sendMms<sup>11+</sup> 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_cisendMms\(context: Context, mmsParams: MmsParams, callback: AsyncCallback<void>\): void 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ciSends an MMS message. This API uses an asynchronous callback to return the result. 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ci**System API**: This is a system API. 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.SEND_MESSAGES 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ci**Parameters** 32e41f4b71Sopenharmony_ci 33e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 34e41f4b71Sopenharmony_ci| -------- | --------------------------- | ---- | ---------------------------------------- | 35e41f4b71Sopenharmony_ci| context | Context | Yes | Application context.<br>For details about the application context of the FA model, see [Context](../apis-ability-kit/js-apis-inner-app-context.md).<br>For details about the application context of the stage model, see [Context](../apis-ability-kit/js-apis-inner-application-uiAbilityContext.md).| 36e41f4b71Sopenharmony_ci| mmsParams | [MmsParams](#mmsparams11) | Yes | Parameters (including the callback) for sending MMS messages. For details, see [MmsParams](#mmsparams11).| 37e41f4b71Sopenharmony_ci| callback | AsyncCallback<void> | Yes | Callback used to return the result.| 38e41f4b71Sopenharmony_ci 39e41f4b71Sopenharmony_ci**Error codes** 40e41f4b71Sopenharmony_ci 41e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 42e41f4b71Sopenharmony_ci 43e41f4b71Sopenharmony_ci| ID| Error Message | 44e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 45e41f4b71Sopenharmony_ci| 201 | Permission denied. | 46e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 47e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 48e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 49e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 50e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 51e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 52e41f4b71Sopenharmony_ci 53e41f4b71Sopenharmony_ci**Example** 54e41f4b71Sopenharmony_ci 55e41f4b71Sopenharmony_ciFA model: 56e41f4b71Sopenharmony_ci<!--code_no_check_fa--> 57e41f4b71Sopenharmony_ci```ts 58e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 59e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 60e41f4b71Sopenharmony_ciimport { common, featureAbility } from '@kit.AbilityKit'; 61e41f4b71Sopenharmony_ci 62e41f4b71Sopenharmony_ci// Obtain the context. 63e41f4b71Sopenharmony_cilet context: common.BaseContext = featureAbility.getContext(); 64e41f4b71Sopenharmony_ci 65e41f4b71Sopenharmony_ci// Configure the path for storing PDUs of MMS messages. Such PDUs are sent from the encoding API. 66e41f4b71Sopenharmony_ciconst sandBoxPath: string = '/data/storage/el2/base/files/'; 67e41f4b71Sopenharmony_cilet filePath: string = sandBoxPath + 'SendReq.mms'; 68e41f4b71Sopenharmony_ci 69e41f4b71Sopenharmony_ci// Options for sending MMS messages (The MMSC is for reference only.) 70e41f4b71Sopenharmony_cilet mmsPars: sms.MmsParams = { 71e41f4b71Sopenharmony_ci slotId : 0, 72e41f4b71Sopenharmony_ci mmsc: 'http://mmsc.myuni.com.cn', 73e41f4b71Sopenharmony_ci data: filePath, 74e41f4b71Sopenharmony_ci mmsConfig: { 75e41f4b71Sopenharmony_ci userAgent:'ua', 76e41f4b71Sopenharmony_ci userAgentProfile: 'uaprof' 77e41f4b71Sopenharmony_ci } 78e41f4b71Sopenharmony_ci}; 79e41f4b71Sopenharmony_ci 80e41f4b71Sopenharmony_ci// Call the sendMms API. 81e41f4b71Sopenharmony_cisms.sendMms(context, mmsPars, async(err: BusinessError) =>{ 82e41f4b71Sopenharmony_ci if (err) { 83e41f4b71Sopenharmony_ci console.error(`sendMms fail, err : ${JSON.stringify(err)}`); 84e41f4b71Sopenharmony_ci return; 85e41f4b71Sopenharmony_ci } 86e41f4b71Sopenharmony_ci console.log(`sendMms Success`); 87e41f4b71Sopenharmony_ci}) 88e41f4b71Sopenharmony_ci``` 89e41f4b71Sopenharmony_ci 90e41f4b71Sopenharmony_ciStage model: 91e41f4b71Sopenharmony_ci 92e41f4b71Sopenharmony_ci```ts 93e41f4b71Sopenharmony_ciimport { UIAbility } from '@kit.AbilityKit'; 94e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 95e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 96e41f4b71Sopenharmony_ciimport { window } from '@kit.ArkUI'; 97e41f4b71Sopenharmony_ci 98e41f4b71Sopenharmony_ci// Configure the path for storing PDUs of MMS messages. Such PDUs are sent from the encoding API. 99e41f4b71Sopenharmony_ciconst sandBoxPath = '/data/storage/el2/base/files/'; 100e41f4b71Sopenharmony_cilet filePath = sandBoxPath + 'SendReq.mms'; 101e41f4b71Sopenharmony_ci 102e41f4b71Sopenharmony_ci// Configure the MMS user agent and profile. The default values are ua and uaprof, respectively. The configuration is subject to the carrier's requirements. 103e41f4b71Sopenharmony_cilet mmsConf: sms.MmsConfig = { 104e41f4b71Sopenharmony_ci userAgent:'ua', 105e41f4b71Sopenharmony_ci userAgentProfile: 'uaprof' 106e41f4b71Sopenharmony_ci}; 107e41f4b71Sopenharmony_ci 108e41f4b71Sopenharmony_ci// Options for sending MMS messages (The MMSC is for reference only.) 109e41f4b71Sopenharmony_cilet mmsPars: sms.MmsParams = { 110e41f4b71Sopenharmony_ci slotId : 0, 111e41f4b71Sopenharmony_ci mmsc: 'http://mmsc.myuni.com.cn', 112e41f4b71Sopenharmony_ci data: filePath, 113e41f4b71Sopenharmony_ci mmsConfig: mmsConf 114e41f4b71Sopenharmony_ci}; 115e41f4b71Sopenharmony_ci 116e41f4b71Sopenharmony_ciclass EntryAbility extends UIAbility { 117e41f4b71Sopenharmony_ci onWindowStageCreate(windowStage: window.WindowStage) { 118e41f4b71Sopenharmony_ci sms.sendMms(this.context, mmsPars, async(err: BusinessError) =>{ 119e41f4b71Sopenharmony_ci if (err) { 120e41f4b71Sopenharmony_ci console.error(`sendMms fail, err : ${JSON.stringify(err)}`); 121e41f4b71Sopenharmony_ci return; 122e41f4b71Sopenharmony_ci } 123e41f4b71Sopenharmony_ci console.log(`sendMms Success`); 124e41f4b71Sopenharmony_ci }) 125e41f4b71Sopenharmony_ci } 126e41f4b71Sopenharmony_ci} 127e41f4b71Sopenharmony_ci``` 128e41f4b71Sopenharmony_ci 129e41f4b71Sopenharmony_ci## sms.sendMms<sup>11+</sup> 130e41f4b71Sopenharmony_ci 131e41f4b71Sopenharmony_cisendMms\(context: Context, mmsParams: MmsParams\): Promise<void> 132e41f4b71Sopenharmony_ci 133e41f4b71Sopenharmony_ciSends an MMS message. This API uses a promise to return the result. 134e41f4b71Sopenharmony_ci 135e41f4b71Sopenharmony_ci**System API**: This is a system API. 136e41f4b71Sopenharmony_ci 137e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.SEND_MESSAGES 138e41f4b71Sopenharmony_ci 139e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 140e41f4b71Sopenharmony_ci 141e41f4b71Sopenharmony_ci**Parameters** 142e41f4b71Sopenharmony_ci 143e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 144e41f4b71Sopenharmony_ci| -------- | --------------------------- | ---- | ---------------------------------------- | 145e41f4b71Sopenharmony_ci| context | Context | Yes | Application context.<br>For details about the application context of the FA model, see [Context](../apis-ability-kit/js-apis-inner-app-context.md).<br>For details about the application context of the stage model, see [Context](../apis-ability-kit/js-apis-inner-application-uiAbilityContext.md).| 146e41f4b71Sopenharmony_ci| mmsParams | [MmsParams](#mmsparams11) | Yes | Parameters (including the callback) for sending MMS messages. For details, see [MmsParams](#mmsparams11).| 147e41f4b71Sopenharmony_ci 148e41f4b71Sopenharmony_ci**Return value** 149e41f4b71Sopenharmony_ci 150e41f4b71Sopenharmony_ci| Type | Description | 151e41f4b71Sopenharmony_ci| --------------- | ------------------------------------------------------------ | 152e41f4b71Sopenharmony_ci| Promise<void> | Promise used to return the result.| 153e41f4b71Sopenharmony_ci 154e41f4b71Sopenharmony_ci**Error codes** 155e41f4b71Sopenharmony_ci 156e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 157e41f4b71Sopenharmony_ci 158e41f4b71Sopenharmony_ci| ID| Error Message | 159e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 160e41f4b71Sopenharmony_ci| 201 | Permission denied. | 161e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 162e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 163e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 164e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 165e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 166e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 167e41f4b71Sopenharmony_ci 168e41f4b71Sopenharmony_ci**Example** 169e41f4b71Sopenharmony_ci 170e41f4b71Sopenharmony_ciFA model: 171e41f4b71Sopenharmony_ci<!--code_no_check_fa--> 172e41f4b71Sopenharmony_ci```ts 173e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 174e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 175e41f4b71Sopenharmony_ciimport { common, featureAbility } from '@kit.AbilityKit'; 176e41f4b71Sopenharmony_ci 177e41f4b71Sopenharmony_ci// Obtain the context. 178e41f4b71Sopenharmony_cilet context: common.BaseContext = featureAbility.getContext(); 179e41f4b71Sopenharmony_ci 180e41f4b71Sopenharmony_ci// Configure the path for storing PDUs of MMS messages. Such PDUs are sent from the encoding API. 181e41f4b71Sopenharmony_ciconst sandBoxPath: string = '/data/storage/el2/base/files/'; 182e41f4b71Sopenharmony_cilet filePath: string = sandBoxPath + 'SendReq.mms'; 183e41f4b71Sopenharmony_ci 184e41f4b71Sopenharmony_ci// Options for sending MMS messages (The MMSC is for reference only.) 185e41f4b71Sopenharmony_cilet mmsPars: sms.MmsParams = { 186e41f4b71Sopenharmony_ci slotId: 0, 187e41f4b71Sopenharmony_ci mmsc: 'http://mmsc.myuni.com.cn', 188e41f4b71Sopenharmony_ci data: filePath, 189e41f4b71Sopenharmony_ci mmsConfig: { 190e41f4b71Sopenharmony_ci userAgent:'ua', 191e41f4b71Sopenharmony_ci userAgentProfile: 'uaprof' 192e41f4b71Sopenharmony_ci } 193e41f4b71Sopenharmony_ci}; 194e41f4b71Sopenharmony_ci 195e41f4b71Sopenharmony_ci// Call the sendMms API. 196e41f4b71Sopenharmony_cilet promise = sms.sendMms(context, mmsPars); 197e41f4b71Sopenharmony_cipromise.then(() => { 198e41f4b71Sopenharmony_ci console.log(`sendMms success`); 199e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 200e41f4b71Sopenharmony_ci console.error(`sendMms failed, promise: err->${JSON.stringify(err)}`); 201e41f4b71Sopenharmony_ci}); 202e41f4b71Sopenharmony_ci``` 203e41f4b71Sopenharmony_ci 204e41f4b71Sopenharmony_ciStage model: 205e41f4b71Sopenharmony_ci 206e41f4b71Sopenharmony_ci```ts 207e41f4b71Sopenharmony_ciimport { UIAbility } from '@kit.AbilityKit'; 208e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 209e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 210e41f4b71Sopenharmony_ciimport { window } from '@kit.ArkUI'; 211e41f4b71Sopenharmony_ci 212e41f4b71Sopenharmony_ci// Configure the path for storing PDUs of MMS messages. Such PDUs are sent from the encoding API. 213e41f4b71Sopenharmony_ciconst sandBoxPath = '/data/storage/el2/base/files/'; 214e41f4b71Sopenharmony_cilet filePath = sandBoxPath + 'SendReq.mms'; 215e41f4b71Sopenharmony_ci 216e41f4b71Sopenharmony_ci// Configure the MMS user agent and profile. The default values are ua and uaprof, respectively. The configuration is subject to the carrier's requirements. 217e41f4b71Sopenharmony_cilet mmsConf: sms.MmsConfig = { 218e41f4b71Sopenharmony_ci userAgent:'ua', 219e41f4b71Sopenharmony_ci userAgentProfile: 'uaprof' 220e41f4b71Sopenharmony_ci}; 221e41f4b71Sopenharmony_ci 222e41f4b71Sopenharmony_ci// Options for sending MMS messages (The MMSC is for reference only.) 223e41f4b71Sopenharmony_cilet mmsPars: sms.MmsParams = { 224e41f4b71Sopenharmony_ci slotId : 0, 225e41f4b71Sopenharmony_ci mmsc: 'http://mmsc.myuni.com.cn', 226e41f4b71Sopenharmony_ci data: filePath, 227e41f4b71Sopenharmony_ci mmsConfig: mmsConf 228e41f4b71Sopenharmony_ci}; 229e41f4b71Sopenharmony_ci 230e41f4b71Sopenharmony_ciclass EntryAbility extends UIAbility { 231e41f4b71Sopenharmony_ci onWindowStageCreate(windowStage: window.WindowStage) { 232e41f4b71Sopenharmony_ci let promise = sms.sendMms(this.context, mmsPars); 233e41f4b71Sopenharmony_ci promise.then(() => { 234e41f4b71Sopenharmony_ci console.log(`sendMms success`); 235e41f4b71Sopenharmony_ci }).catch((err: BusinessError) => { 236e41f4b71Sopenharmony_ci console.error(`sendMms failed, promise: err->${JSON.stringify(err)}`); 237e41f4b71Sopenharmony_ci }); 238e41f4b71Sopenharmony_ci } 239e41f4b71Sopenharmony_ci} 240e41f4b71Sopenharmony_ci``` 241e41f4b71Sopenharmony_ci 242e41f4b71Sopenharmony_ci## sms.downloadMms<sup>11+</sup> 243e41f4b71Sopenharmony_ci 244e41f4b71Sopenharmony_cidownloadMms\(context: Context, mmsParams: MmsParams, callback: AsyncCallback<void>\): void 245e41f4b71Sopenharmony_ci 246e41f4b71Sopenharmony_ciDownloads an MMS message. This API uses an asynchronous callback to return the result. 247e41f4b71Sopenharmony_ci 248e41f4b71Sopenharmony_ci**System API**: This is a system API. 249e41f4b71Sopenharmony_ci 250e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.RECEIVE_MMS 251e41f4b71Sopenharmony_ci 252e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 253e41f4b71Sopenharmony_ci 254e41f4b71Sopenharmony_ci**Parameters** 255e41f4b71Sopenharmony_ci 256e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 257e41f4b71Sopenharmony_ci| -------- | --------------------------- | ---- | ---------------------------------------- | 258e41f4b71Sopenharmony_ci| context | Context | Yes | Application context.<br>For details about the application context of the FA model, see [Context](../apis-ability-kit/js-apis-inner-app-context.md).<br>For details about the application context of the stage model, see [Context](../apis-ability-kit/js-apis-inner-application-uiAbilityContext.md).| 259e41f4b71Sopenharmony_ci| mmsParams | [MmsParams](#mmsparams11) | Yes | Parameters (including the callback) for downloading MMS messages. For details, see [MmsParams](#mmsparams11).| 260e41f4b71Sopenharmony_ci| callback | AsyncCallback<void> | Yes | Callback used to return the result.| 261e41f4b71Sopenharmony_ci 262e41f4b71Sopenharmony_ci**Error codes** 263e41f4b71Sopenharmony_ci 264e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 265e41f4b71Sopenharmony_ci 266e41f4b71Sopenharmony_ci| ID| Error Message | 267e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 268e41f4b71Sopenharmony_ci| 201 | Permission denied. | 269e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 270e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 271e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 272e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 273e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 274e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 275e41f4b71Sopenharmony_ci 276e41f4b71Sopenharmony_ci**Example** 277e41f4b71Sopenharmony_ci 278e41f4b71Sopenharmony_ciFA model: 279e41f4b71Sopenharmony_ci<!--code_no_check_fa--> 280e41f4b71Sopenharmony_ci```ts 281e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 282e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 283e41f4b71Sopenharmony_ciimport { common, featureAbility } from '@kit.AbilityKit'; 284e41f4b71Sopenharmony_ci 285e41f4b71Sopenharmony_ci// Obtain the context. 286e41f4b71Sopenharmony_cilet context: common.BaseContext = featureAbility.getContext(); 287e41f4b71Sopenharmony_ci 288e41f4b71Sopenharmony_ci// Configure the path for storing the PDU of the MMS message. 289e41f4b71Sopenharmony_ciconst sandBoxPath: string = '/data/storage/el2/base/files/'; 290e41f4b71Sopenharmony_cilet filePath: string = sandBoxPath + 'RetrieveConf.mms'; 291e41f4b71Sopenharmony_ci 292e41f4b71Sopenharmony_ci// Parse the MMS URL from the WAP Push message. 293e41f4b71Sopenharmony_cilet wapPushUrl: string = 'URL'; 294e41f4b71Sopenharmony_ci 295e41f4b71Sopenharmony_ci// Configure the parameters (including the callback) for downloading MMS messages. 296e41f4b71Sopenharmony_cilet mmsPars: sms.MmsParams = { 297e41f4b71Sopenharmony_ci slotId: 0, 298e41f4b71Sopenharmony_ci mmsc: wapPushUrl, 299e41f4b71Sopenharmony_ci data: filePath, 300e41f4b71Sopenharmony_ci mmsConfig: { 301e41f4b71Sopenharmony_ci userAgent:'ua', 302e41f4b71Sopenharmony_ci userAgentProfile: 'uaprof' 303e41f4b71Sopenharmony_ci } 304e41f4b71Sopenharmony_ci}; 305e41f4b71Sopenharmony_ci 306e41f4b71Sopenharmony_ci// Call the downloadMms API. 307e41f4b71Sopenharmony_cisms.downloadMms(context, mmsPars, async(err: BusinessError) =>{ 308e41f4b71Sopenharmony_ci if (err) { 309e41f4b71Sopenharmony_ci console.error(`downloadMms fail, err : ${JSON.stringify(err)}`); 310e41f4b71Sopenharmony_ci return; 311e41f4b71Sopenharmony_ci } 312e41f4b71Sopenharmony_ci console.log(`downloadMms Success`); 313e41f4b71Sopenharmony_ci}) 314e41f4b71Sopenharmony_ci``` 315e41f4b71Sopenharmony_ci 316e41f4b71Sopenharmony_ciStage model: 317e41f4b71Sopenharmony_ci 318e41f4b71Sopenharmony_ci```ts 319e41f4b71Sopenharmony_ciimport { UIAbility } from '@kit.AbilityKit'; 320e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 321e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 322e41f4b71Sopenharmony_ciimport { window } from '@kit.ArkUI'; 323e41f4b71Sopenharmony_ci 324e41f4b71Sopenharmony_ci// Configure the path for storing the PDU of the MMS message. 325e41f4b71Sopenharmony_ciconst sandBoxPath = '/data/storage/el2/base/files/'; 326e41f4b71Sopenharmony_cilet filePath = sandBoxPath + 'RetrieveConf.mms'; 327e41f4b71Sopenharmony_ci 328e41f4b71Sopenharmony_ci// Parse the MMS URL from the WAP Push message. 329e41f4b71Sopenharmony_cilet wapPushUrl = 'URL'; 330e41f4b71Sopenharmony_ci 331e41f4b71Sopenharmony_ci// Configure the MMS user agent and profile. The default values are ua and uaprof, respectively. The configuration is subject to the carrier's requirements. 332e41f4b71Sopenharmony_cilet mmsConf: sms.MmsConfig = { 333e41f4b71Sopenharmony_ci userAgent:'ua', 334e41f4b71Sopenharmony_ci userAgentProfile: 'uaprof' 335e41f4b71Sopenharmony_ci}; 336e41f4b71Sopenharmony_ci 337e41f4b71Sopenharmony_ci// Configure the parameters (including the callback) for downloading MMS messages. 338e41f4b71Sopenharmony_cilet mmsPars: sms.MmsParams = { 339e41f4b71Sopenharmony_ci slotId : 0, 340e41f4b71Sopenharmony_ci mmsc: wapPushUrl, 341e41f4b71Sopenharmony_ci data: filePath, 342e41f4b71Sopenharmony_ci mmsConfig: mmsConf 343e41f4b71Sopenharmony_ci}; 344e41f4b71Sopenharmony_ci 345e41f4b71Sopenharmony_ciclass EntryAbility extends UIAbility { 346e41f4b71Sopenharmony_ci onWindowStageCreate(windowStage: window.WindowStage) { 347e41f4b71Sopenharmony_ci sms.downloadMms(this.context, mmsPars, async(err: BusinessError) =>{ 348e41f4b71Sopenharmony_ci if (err) { 349e41f4b71Sopenharmony_ci console.error(`downloadMms fail, err : ${JSON.stringify(err)}`); 350e41f4b71Sopenharmony_ci return; 351e41f4b71Sopenharmony_ci } 352e41f4b71Sopenharmony_ci console.log(`downloadMms Success`); 353e41f4b71Sopenharmony_ci }); 354e41f4b71Sopenharmony_ci } 355e41f4b71Sopenharmony_ci} 356e41f4b71Sopenharmony_ci``` 357e41f4b71Sopenharmony_ci 358e41f4b71Sopenharmony_ci## sms.downloadMms<sup>11+</sup> 359e41f4b71Sopenharmony_ci 360e41f4b71Sopenharmony_cidownloadMms\(context: Context, mmsParams: MmsParams\): Promise<void> 361e41f4b71Sopenharmony_ci 362e41f4b71Sopenharmony_ciSends an MMS message. This API uses a promise to return the result. 363e41f4b71Sopenharmony_ci 364e41f4b71Sopenharmony_ci**System API**: This is a system API. 365e41f4b71Sopenharmony_ci 366e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.RECEIVE_MMS 367e41f4b71Sopenharmony_ci 368e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 369e41f4b71Sopenharmony_ci 370e41f4b71Sopenharmony_ci**Parameters** 371e41f4b71Sopenharmony_ci 372e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 373e41f4b71Sopenharmony_ci| -------- | --------------------------- | ---- | ---------------------------------------- | 374e41f4b71Sopenharmony_ci| context | Context | Yes | Application context.<br>For details about the application context of the FA model, see [Context](../apis-ability-kit/js-apis-inner-app-context.md).<br>For details about the application context of the stage model, see [Context](../apis-ability-kit/js-apis-inner-application-uiAbilityContext.md).| 375e41f4b71Sopenharmony_ci| mmsParams | [MmsParams](#mmsparams11) | Yes | Parameters (including the callback) for sending MMS messages. For details, see [MmsParams](#mmsparams11).| 376e41f4b71Sopenharmony_ci 377e41f4b71Sopenharmony_ci**Return value** 378e41f4b71Sopenharmony_ci 379e41f4b71Sopenharmony_ci| Type | Description | 380e41f4b71Sopenharmony_ci| --------------- | ------------------------------------------------------------ | 381e41f4b71Sopenharmony_ci| Promise<void> | Promise used to return the result.| 382e41f4b71Sopenharmony_ci 383e41f4b71Sopenharmony_ci**Error codes** 384e41f4b71Sopenharmony_ci 385e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 386e41f4b71Sopenharmony_ci 387e41f4b71Sopenharmony_ci| ID| Error Message | 388e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 389e41f4b71Sopenharmony_ci| 201 | Permission denied. | 390e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 391e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 392e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 393e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 394e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 395e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 396e41f4b71Sopenharmony_ci 397e41f4b71Sopenharmony_ci**Example** 398e41f4b71Sopenharmony_ci 399e41f4b71Sopenharmony_ciFA model: 400e41f4b71Sopenharmony_ci<!--code_no_check_fa--> 401e41f4b71Sopenharmony_ci```ts 402e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 403e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 404e41f4b71Sopenharmony_ciimport { common, featureAbility } from '@kit.AbilityKit'; 405e41f4b71Sopenharmony_ci 406e41f4b71Sopenharmony_ci// Obtain the context. 407e41f4b71Sopenharmony_cilet context: common.BaseContext = featureAbility.getContext(); 408e41f4b71Sopenharmony_ci 409e41f4b71Sopenharmony_ci// Configure the path for storing the PDU of the MMS message. 410e41f4b71Sopenharmony_ciconst sandBoxPath: string = '/data/storage/el2/base/files/'; 411e41f4b71Sopenharmony_cilet filePath: string = sandBoxPath + 'RetrieveConf.mms'; 412e41f4b71Sopenharmony_ci 413e41f4b71Sopenharmony_ci// Parse the MMS URL from the WAP Push message. 414e41f4b71Sopenharmony_cilet wapPushUrl: string = 'URL'; 415e41f4b71Sopenharmony_ci 416e41f4b71Sopenharmony_ci// Configure the parameters (including the callback) for downloading MMS messages. 417e41f4b71Sopenharmony_cilet mmsPars: sms.MmsParams = { 418e41f4b71Sopenharmony_ci slotId: 0, 419e41f4b71Sopenharmony_ci mmsc: wapPushUrl, 420e41f4b71Sopenharmony_ci data: filePath, 421e41f4b71Sopenharmony_ci mmsConfig: { 422e41f4b71Sopenharmony_ci userAgent:'ua', 423e41f4b71Sopenharmony_ci userAgentProfile: 'uaprof' 424e41f4b71Sopenharmony_ci } 425e41f4b71Sopenharmony_ci}; 426e41f4b71Sopenharmony_ci 427e41f4b71Sopenharmony_ci// Call the sendMms API. 428e41f4b71Sopenharmony_cilet promise = sms.downloadMms(context, mmsPars); 429e41f4b71Sopenharmony_cipromise.then(() => { 430e41f4b71Sopenharmony_ci console.log(`downloadMms success`); 431e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 432e41f4b71Sopenharmony_ci console.error(`downloadMms failed, promise: err->${JSON.stringify(err)}`); 433e41f4b71Sopenharmony_ci}); 434e41f4b71Sopenharmony_ci``` 435e41f4b71Sopenharmony_ci 436e41f4b71Sopenharmony_ciStage model: 437e41f4b71Sopenharmony_ci 438e41f4b71Sopenharmony_ci```ts 439e41f4b71Sopenharmony_ciimport { UIAbility } from '@kit.AbilityKit'; 440e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 441e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 442e41f4b71Sopenharmony_ciimport { window } from '@kit.ArkUI'; 443e41f4b71Sopenharmony_ci 444e41f4b71Sopenharmony_ci// Configure the path for storing the PDU of the MMS message. 445e41f4b71Sopenharmony_ciconst sandBoxPath = '/data/storage/el2/base/files/'; 446e41f4b71Sopenharmony_cilet filePath = sandBoxPath + 'RetrieveConf.mms'; 447e41f4b71Sopenharmony_ci 448e41f4b71Sopenharmony_ci// Parse the MMS URL from the WAP Push message. 449e41f4b71Sopenharmony_cilet wapPushUrl = 'URL'; 450e41f4b71Sopenharmony_ci 451e41f4b71Sopenharmony_ci// Configure the MMS user agent and profile. The default values are ua and uaprof, respectively. The configuration is subject to the carrier's requirements. 452e41f4b71Sopenharmony_cilet mmsConf: sms.MmsConfig = { 453e41f4b71Sopenharmony_ci userAgent:'ua', 454e41f4b71Sopenharmony_ci userAgentProfile: 'uaprof' 455e41f4b71Sopenharmony_ci}; 456e41f4b71Sopenharmony_ci 457e41f4b71Sopenharmony_ci// Configure the parameters (including the callback) for downloading MMS messages. 458e41f4b71Sopenharmony_cilet mmsPars: sms.MmsParams = { 459e41f4b71Sopenharmony_ci slotId : 0, 460e41f4b71Sopenharmony_ci mmsc: wapPushUrl, 461e41f4b71Sopenharmony_ci data: filePath, 462e41f4b71Sopenharmony_ci mmsConfig: mmsConf 463e41f4b71Sopenharmony_ci}; 464e41f4b71Sopenharmony_ci 465e41f4b71Sopenharmony_ciclass EntryAbility extends UIAbility { 466e41f4b71Sopenharmony_ci onWindowStageCreate(windowStage: window.WindowStage) { 467e41f4b71Sopenharmony_ci let promise = sms.downloadMms(this.context, mmsPars); 468e41f4b71Sopenharmony_ci promise.then(() => { 469e41f4b71Sopenharmony_ci console.log(`downloadMms success`); 470e41f4b71Sopenharmony_ci }).catch((err: BusinessError) => { 471e41f4b71Sopenharmony_ci console.error(`downloadMms failed, promise: err->${JSON.stringify(err)}`); 472e41f4b71Sopenharmony_ci }); 473e41f4b71Sopenharmony_ci } 474e41f4b71Sopenharmony_ci} 475e41f4b71Sopenharmony_ci``` 476e41f4b71Sopenharmony_ci 477e41f4b71Sopenharmony_ci 478e41f4b71Sopenharmony_ci## sms.setDefaultSmsSlotId<sup>7+</sup> 479e41f4b71Sopenharmony_ci 480e41f4b71Sopenharmony_cisetDefaultSmsSlotId\(slotId: number, callback: AsyncCallback<void>\): void 481e41f4b71Sopenharmony_ci 482e41f4b71Sopenharmony_ciSets the default slot ID of the SIM card used to send SMS messages. This API uses an asynchronous callback to return the result. 483e41f4b71Sopenharmony_ci 484e41f4b71Sopenharmony_ci**System API**: This is a system API. 485e41f4b71Sopenharmony_ci 486e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.SET_TELEPHONY_STATE 487e41f4b71Sopenharmony_ci 488e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 489e41f4b71Sopenharmony_ci 490e41f4b71Sopenharmony_ci**Parameters** 491e41f4b71Sopenharmony_ci 492e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 493e41f4b71Sopenharmony_ci| -------- | ------------------------- | ---- | ------------------------------------------------------------ | 494e41f4b71Sopenharmony_ci| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2<br>- **-1**: Clears the default configuration.| 495e41f4b71Sopenharmony_ci| callback | AsyncCallback<void> | Yes | Callback used to return the result. | 496e41f4b71Sopenharmony_ci 497e41f4b71Sopenharmony_ci**Error codes** 498e41f4b71Sopenharmony_ci 499e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 500e41f4b71Sopenharmony_ci 501e41f4b71Sopenharmony_ci| ID| Error Message | 502e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 503e41f4b71Sopenharmony_ci| 201 | Permission denied. | 504e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 505e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 506e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 507e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 508e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 509e41f4b71Sopenharmony_ci| 8300004 | Do not have sim card. | 510e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 511e41f4b71Sopenharmony_ci 512e41f4b71Sopenharmony_ci**Example** 513e41f4b71Sopenharmony_ci 514e41f4b71Sopenharmony_ci```ts 515e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 516e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 517e41f4b71Sopenharmony_ci 518e41f4b71Sopenharmony_cisms.setDefaultSmsSlotId(0, (err: BusinessError) => { 519e41f4b71Sopenharmony_ci console.log(`callback: err->${JSON.stringify(err)}.`); 520e41f4b71Sopenharmony_ci}); 521e41f4b71Sopenharmony_ci``` 522e41f4b71Sopenharmony_ci 523e41f4b71Sopenharmony_ci 524e41f4b71Sopenharmony_ci## sms.setDefaultSmsSlotId<sup>7+</sup> 525e41f4b71Sopenharmony_ci 526e41f4b71Sopenharmony_cisetDefaultSmsSlotId\(slotId: number\): Promise<void> 527e41f4b71Sopenharmony_ci 528e41f4b71Sopenharmony_ciSets the default slot ID of the SIM card used to send SMS messages. This API uses a promise to return the result. 529e41f4b71Sopenharmony_ci 530e41f4b71Sopenharmony_ci**System API**: This is a system API. 531e41f4b71Sopenharmony_ci 532e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.SET_TELEPHONY_STATE 533e41f4b71Sopenharmony_ci 534e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 535e41f4b71Sopenharmony_ci 536e41f4b71Sopenharmony_ci**Parameters** 537e41f4b71Sopenharmony_ci 538e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 539e41f4b71Sopenharmony_ci| ------ | ------ | ---- | ------------------------------------------------------------ | 540e41f4b71Sopenharmony_ci| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2<br>- **-1**: Clears the default configuration.| 541e41f4b71Sopenharmony_ci 542e41f4b71Sopenharmony_ci**Return value** 543e41f4b71Sopenharmony_ci 544e41f4b71Sopenharmony_ci| Type | Description | 545e41f4b71Sopenharmony_ci| --------------- | ------------------------------- | 546e41f4b71Sopenharmony_ci| Promise\<void\> | Promise used to return the result.| 547e41f4b71Sopenharmony_ci 548e41f4b71Sopenharmony_ci**Error codes** 549e41f4b71Sopenharmony_ci 550e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 551e41f4b71Sopenharmony_ci 552e41f4b71Sopenharmony_ci| ID| Error Message | 553e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 554e41f4b71Sopenharmony_ci| 201 | Permission denied. | 555e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 556e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 557e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 558e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 559e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 560e41f4b71Sopenharmony_ci| 8300004 | Do not have sim card. | 561e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 562e41f4b71Sopenharmony_ci 563e41f4b71Sopenharmony_ci**Example** 564e41f4b71Sopenharmony_ci 565e41f4b71Sopenharmony_ci```ts 566e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 567e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 568e41f4b71Sopenharmony_ci 569e41f4b71Sopenharmony_cisms.setDefaultSmsSlotId(0).then(() => { 570e41f4b71Sopenharmony_ci console.log(`setDefaultSmsSlotId success.`); 571e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 572e41f4b71Sopenharmony_ci console.error(`setDefaultSmsSlotId failed, promise: err->${JSON.stringify(err)}`); 573e41f4b71Sopenharmony_ci}); 574e41f4b71Sopenharmony_ci``` 575e41f4b71Sopenharmony_ci 576e41f4b71Sopenharmony_ci## sms.setSmscAddr<sup>7+</sup> 577e41f4b71Sopenharmony_ci 578e41f4b71Sopenharmony_cisetSmscAddr\(slotId: number, smscAddr: string, callback: AsyncCallback\<void\>\): void 579e41f4b71Sopenharmony_ci 580e41f4b71Sopenharmony_ciSets the short message service center (SMSC) address. This API uses an asynchronous callback to return the result. 581e41f4b71Sopenharmony_ci 582e41f4b71Sopenharmony_ci**System API**: This is a system API. 583e41f4b71Sopenharmony_ci 584e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.SET_TELEPHONY_STATE (a system permission) 585e41f4b71Sopenharmony_ci 586e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 587e41f4b71Sopenharmony_ci 588e41f4b71Sopenharmony_ci**Parameters** 589e41f4b71Sopenharmony_ci 590e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 591e41f4b71Sopenharmony_ci| -------- | ------------------------- | ---- | ----------------------------------------- | 592e41f4b71Sopenharmony_ci| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| 593e41f4b71Sopenharmony_ci| smscAddr | string | Yes | SMSC address. | 594e41f4b71Sopenharmony_ci| callback | AsyncCallback<void> | Yes | Callback used to return the result. | 595e41f4b71Sopenharmony_ci 596e41f4b71Sopenharmony_ci**Error codes** 597e41f4b71Sopenharmony_ci 598e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 599e41f4b71Sopenharmony_ci 600e41f4b71Sopenharmony_ci| ID| Error Message | 601e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 602e41f4b71Sopenharmony_ci| 201 | Permission denied. | 603e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 604e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 605e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 606e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 607e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 608e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 609e41f4b71Sopenharmony_ci 610e41f4b71Sopenharmony_ci**Example** 611e41f4b71Sopenharmony_ci 612e41f4b71Sopenharmony_ci```ts 613e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 614e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 615e41f4b71Sopenharmony_ci 616e41f4b71Sopenharmony_cilet slotId: number = 0; 617e41f4b71Sopenharmony_cilet smscAddr: string = '+861xxxxxxxxxx'; 618e41f4b71Sopenharmony_cisms.setSmscAddr(slotId, smscAddr, (err: BusinessError) => { 619e41f4b71Sopenharmony_ci console.log(`callback: err->${JSON.stringify(err)}`); 620e41f4b71Sopenharmony_ci}); 621e41f4b71Sopenharmony_ci``` 622e41f4b71Sopenharmony_ci 623e41f4b71Sopenharmony_ci 624e41f4b71Sopenharmony_ci## sms.setSmscAddr<sup>7+</sup> 625e41f4b71Sopenharmony_ci 626e41f4b71Sopenharmony_cisetSmscAddr\(slotId: number, smscAddr: string\): Promise\<void\> 627e41f4b71Sopenharmony_ci 628e41f4b71Sopenharmony_ciSets the SMSC address. This API uses a promise to return the result. 629e41f4b71Sopenharmony_ci 630e41f4b71Sopenharmony_ci**System API**: This is a system API. 631e41f4b71Sopenharmony_ci 632e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.SET_TELEPHONY_STATE (a system permission) 633e41f4b71Sopenharmony_ci 634e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 635e41f4b71Sopenharmony_ci 636e41f4b71Sopenharmony_ci**Parameters** 637e41f4b71Sopenharmony_ci 638e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 639e41f4b71Sopenharmony_ci| -------- | ------ | ---- | ----------------------------------------- | 640e41f4b71Sopenharmony_ci| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| 641e41f4b71Sopenharmony_ci| smscAddr | string | Yes | SMSC address. | 642e41f4b71Sopenharmony_ci 643e41f4b71Sopenharmony_ci**Return value** 644e41f4b71Sopenharmony_ci 645e41f4b71Sopenharmony_ci| Type | Description | 646e41f4b71Sopenharmony_ci| ------------------- | ------------------------------- | 647e41f4b71Sopenharmony_ci| Promise<void> | Promise used to return the result.| 648e41f4b71Sopenharmony_ci 649e41f4b71Sopenharmony_ci**Error codes** 650e41f4b71Sopenharmony_ci 651e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 652e41f4b71Sopenharmony_ci 653e41f4b71Sopenharmony_ci| ID| Error Message | 654e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 655e41f4b71Sopenharmony_ci| 201 | Permission denied. | 656e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 657e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 658e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 659e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 660e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 661e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 662e41f4b71Sopenharmony_ci 663e41f4b71Sopenharmony_ci**Example** 664e41f4b71Sopenharmony_ci 665e41f4b71Sopenharmony_ci```ts 666e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 667e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 668e41f4b71Sopenharmony_ci 669e41f4b71Sopenharmony_cilet slotId: number = 0; 670e41f4b71Sopenharmony_cilet smscAddr: string = '+861xxxxxxxxxx'; 671e41f4b71Sopenharmony_cisms.setSmscAddr(slotId, smscAddr).then(() => { 672e41f4b71Sopenharmony_ci console.log(`setSmscAddr success.`); 673e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 674e41f4b71Sopenharmony_ci console.error(`setSmscAddr failed, promise: err->${JSON.stringify(err)}`); 675e41f4b71Sopenharmony_ci}); 676e41f4b71Sopenharmony_ci``` 677e41f4b71Sopenharmony_ci 678e41f4b71Sopenharmony_ci 679e41f4b71Sopenharmony_ci## sms.getSmscAddr<sup>7+</sup> 680e41f4b71Sopenharmony_ci 681e41f4b71Sopenharmony_cigetSmscAddr\(slotId: number, callback: AsyncCallback\<string\>\): void 682e41f4b71Sopenharmony_ci 683e41f4b71Sopenharmony_ciObtains the SMSC address. This API uses an asynchronous callback to return the result. 684e41f4b71Sopenharmony_ci 685e41f4b71Sopenharmony_ci**System API**: This is a system API. 686e41f4b71Sopenharmony_ci 687e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.GET_TELEPHONY_STATE (a system permission) 688e41f4b71Sopenharmony_ci 689e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 690e41f4b71Sopenharmony_ci 691e41f4b71Sopenharmony_ci**Parameters** 692e41f4b71Sopenharmony_ci 693e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 694e41f4b71Sopenharmony_ci| -------- | --------------------------- | ---- | ----------------------------------------- | 695e41f4b71Sopenharmony_ci| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| 696e41f4b71Sopenharmony_ci| callback | AsyncCallback<string> | Yes | Callback used to return the result. | 697e41f4b71Sopenharmony_ci 698e41f4b71Sopenharmony_ci**Error codes** 699e41f4b71Sopenharmony_ci 700e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 701e41f4b71Sopenharmony_ci 702e41f4b71Sopenharmony_ci| ID| Error Message | 703e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 704e41f4b71Sopenharmony_ci| 201 | Permission denied. | 705e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 706e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 707e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 708e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 709e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 710e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 711e41f4b71Sopenharmony_ci 712e41f4b71Sopenharmony_ci**Example** 713e41f4b71Sopenharmony_ci 714e41f4b71Sopenharmony_ci```ts 715e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 716e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 717e41f4b71Sopenharmony_ci 718e41f4b71Sopenharmony_cilet slotId: number = 0; 719e41f4b71Sopenharmony_cisms.getSmscAddr(slotId, (err: BusinessError, data: string) => { 720e41f4b71Sopenharmony_ci console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 721e41f4b71Sopenharmony_ci}); 722e41f4b71Sopenharmony_ci``` 723e41f4b71Sopenharmony_ci 724e41f4b71Sopenharmony_ci 725e41f4b71Sopenharmony_ci## sms.getSmscAddr<sup>7+</sup> 726e41f4b71Sopenharmony_ci 727e41f4b71Sopenharmony_cigetSmscAddr\(slotId: number\): Promise\<string\> 728e41f4b71Sopenharmony_ci 729e41f4b71Sopenharmony_ciObtains the SMSC address. This API uses a promise to return the result. 730e41f4b71Sopenharmony_ci 731e41f4b71Sopenharmony_ci**System API**: This is a system API. 732e41f4b71Sopenharmony_ci 733e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.GET_TELEPHONY_STATE (a system permission) 734e41f4b71Sopenharmony_ci 735e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 736e41f4b71Sopenharmony_ci 737e41f4b71Sopenharmony_ci**Parameters** 738e41f4b71Sopenharmony_ci 739e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 740e41f4b71Sopenharmony_ci| ------ | ------ | ---- | ----------------------------------------- | 741e41f4b71Sopenharmony_ci| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| 742e41f4b71Sopenharmony_ci 743e41f4b71Sopenharmony_ci**Return value** 744e41f4b71Sopenharmony_ci 745e41f4b71Sopenharmony_ci| Type | Description | 746e41f4b71Sopenharmony_ci| --------------------- | --------------------------------------------- | 747e41f4b71Sopenharmony_ci| Promise<string> | Promise used to return the result.| 748e41f4b71Sopenharmony_ci 749e41f4b71Sopenharmony_ci**Error codes** 750e41f4b71Sopenharmony_ci 751e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 752e41f4b71Sopenharmony_ci 753e41f4b71Sopenharmony_ci| ID| Error Message | 754e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 755e41f4b71Sopenharmony_ci| 201 | Permission denied. | 756e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 757e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 758e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 759e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 760e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 761e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 762e41f4b71Sopenharmony_ci 763e41f4b71Sopenharmony_ci**Example** 764e41f4b71Sopenharmony_ci 765e41f4b71Sopenharmony_ci```ts 766e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 767e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 768e41f4b71Sopenharmony_ci 769e41f4b71Sopenharmony_cilet slotId: number = 0; 770e41f4b71Sopenharmony_cisms.getSmscAddr(slotId).then((data: string) => { 771e41f4b71Sopenharmony_ci console.log(`getSmscAddr success, promise: data->${JSON.stringify(data)}`); 772e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 773e41f4b71Sopenharmony_ci console.error(`getSmscAddr failed, promise: err->${JSON.stringify(err)}`); 774e41f4b71Sopenharmony_ci}); 775e41f4b71Sopenharmony_ci``` 776e41f4b71Sopenharmony_ci 777e41f4b71Sopenharmony_ci 778e41f4b71Sopenharmony_ci## sms.splitMessage<sup>8+</sup> 779e41f4b71Sopenharmony_ci 780e41f4b71Sopenharmony_cisplitMessage\(content: string, callback: AsyncCallback\<Array\<string\>\>\): void 781e41f4b71Sopenharmony_ci 782e41f4b71Sopenharmony_ciSplits an SMS message into multiple segments. This API uses an asynchronous callback to return the result. 783e41f4b71Sopenharmony_ci 784e41f4b71Sopenharmony_ci**System API**: This is a system API. 785e41f4b71Sopenharmony_ci 786e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.SEND_MESSAGES 787e41f4b71Sopenharmony_ci 788e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 789e41f4b71Sopenharmony_ci 790e41f4b71Sopenharmony_ci**Parameters** 791e41f4b71Sopenharmony_ci 792e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 793e41f4b71Sopenharmony_ci| -------- | ----------------------------- | ---- | ----------------------------- | 794e41f4b71Sopenharmony_ci| content | string | Yes | SMS message content. The value cannot be null.| 795e41f4b71Sopenharmony_ci| callback | AsyncCallback<Array<string\>> | Yes | Callback used to return the result.| 796e41f4b71Sopenharmony_ci 797e41f4b71Sopenharmony_ci**Error codes** 798e41f4b71Sopenharmony_ci 799e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 800e41f4b71Sopenharmony_ci 801e41f4b71Sopenharmony_ci| ID| Error Message | 802e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 803e41f4b71Sopenharmony_ci| 201 | Permission denied. | 804e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 805e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 806e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 807e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 808e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 809e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 810e41f4b71Sopenharmony_ci 811e41f4b71Sopenharmony_ci**Example** 812e41f4b71Sopenharmony_ci 813e41f4b71Sopenharmony_ci```ts 814e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 815e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 816e41f4b71Sopenharmony_ci 817e41f4b71Sopenharmony_cilet content: string = "long message"; 818e41f4b71Sopenharmony_cisms.splitMessage(content, (err: BusinessError, data: string[]) => { 819e41f4b71Sopenharmony_ci console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 820e41f4b71Sopenharmony_ci}); 821e41f4b71Sopenharmony_ci``` 822e41f4b71Sopenharmony_ci 823e41f4b71Sopenharmony_ci 824e41f4b71Sopenharmony_ci## sms.splitMessage<sup>8+</sup> 825e41f4b71Sopenharmony_ci 826e41f4b71Sopenharmony_cisplitMessage\(content: string\): Promise\<Array\<string\>\> 827e41f4b71Sopenharmony_ci 828e41f4b71Sopenharmony_ciSplits an SMS message into multiple segments. This API uses a promise to return the result. 829e41f4b71Sopenharmony_ci 830e41f4b71Sopenharmony_ci**System API**: This is a system API. 831e41f4b71Sopenharmony_ci 832e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.SEND_MESSAGES 833e41f4b71Sopenharmony_ci 834e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 835e41f4b71Sopenharmony_ci 836e41f4b71Sopenharmony_ci**Parameters** 837e41f4b71Sopenharmony_ci 838e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 839e41f4b71Sopenharmony_ci| ------- | ------ | ---- | ---------------------------- | 840e41f4b71Sopenharmony_ci| content | string | Yes | SMS message content. The value cannot be null.| 841e41f4b71Sopenharmony_ci 842e41f4b71Sopenharmony_ci**Return value** 843e41f4b71Sopenharmony_ci 844e41f4b71Sopenharmony_ci| Type | Description | 845e41f4b71Sopenharmony_ci| ----------------------- | ----------------------------------- | 846e41f4b71Sopenharmony_ci| Promise<Array<string\>> | Promise used to return the result.| 847e41f4b71Sopenharmony_ci 848e41f4b71Sopenharmony_ci**Error codes** 849e41f4b71Sopenharmony_ci 850e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 851e41f4b71Sopenharmony_ci 852e41f4b71Sopenharmony_ci| ID| Error Message | 853e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 854e41f4b71Sopenharmony_ci| 201 | Permission denied. | 855e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 856e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 857e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 858e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 859e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 860e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 861e41f4b71Sopenharmony_ci 862e41f4b71Sopenharmony_ci**Example** 863e41f4b71Sopenharmony_ci 864e41f4b71Sopenharmony_ci```ts 865e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 866e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 867e41f4b71Sopenharmony_ci 868e41f4b71Sopenharmony_cilet content: string = "long message"; 869e41f4b71Sopenharmony_cilet promise = sms.splitMessage(content); 870e41f4b71Sopenharmony_cipromise.then((data: string[]) => { 871e41f4b71Sopenharmony_ci console.log(`splitMessage success, promise: data->${JSON.stringify(data)}`); 872e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 873e41f4b71Sopenharmony_ci console.error(`splitMessage failed, promise: err->${JSON.stringify(err)}`); 874e41f4b71Sopenharmony_ci}); 875e41f4b71Sopenharmony_ci``` 876e41f4b71Sopenharmony_ci 877e41f4b71Sopenharmony_ci## sms.addSimMessage<sup>7+</sup> 878e41f4b71Sopenharmony_ci 879e41f4b71Sopenharmony_ciaddSimMessage\(options: SimMessageOptions, callback: AsyncCallback\<void\>\): void 880e41f4b71Sopenharmony_ci 881e41f4b71Sopenharmony_ciAdds a message to the SIM card. If the SIM card is full, an error is reported. This API uses an asynchronous callback to return the result. 882e41f4b71Sopenharmony_ci 883e41f4b71Sopenharmony_ci**System API**: This is a system API. 884e41f4b71Sopenharmony_ci 885e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES 886e41f4b71Sopenharmony_ci 887e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 888e41f4b71Sopenharmony_ci 889e41f4b71Sopenharmony_ci**Parameters** 890e41f4b71Sopenharmony_ci 891e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 892e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- | ---- | --------------- | 893e41f4b71Sopenharmony_ci| options | [SimMessageOptions](#simmessageoptions7) | Yes | SIM message options.| 894e41f4b71Sopenharmony_ci| callback | AsyncCallback<void> | Yes | Callback used to return the result.| 895e41f4b71Sopenharmony_ci 896e41f4b71Sopenharmony_ci**Error codes** 897e41f4b71Sopenharmony_ci 898e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 899e41f4b71Sopenharmony_ci 900e41f4b71Sopenharmony_ci| ID| Error Message | 901e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 902e41f4b71Sopenharmony_ci| 201 | Permission denied. | 903e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 904e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed. | 905e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 906e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 907e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 908e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 909e41f4b71Sopenharmony_ci 910e41f4b71Sopenharmony_ci**Example** 911e41f4b71Sopenharmony_ci 912e41f4b71Sopenharmony_ci```ts 913e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 914e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 915e41f4b71Sopenharmony_ci 916e41f4b71Sopenharmony_cilet simMessageOptions: sms.SimMessageOptions = { 917e41f4b71Sopenharmony_ci slotId: 0, 918e41f4b71Sopenharmony_ci smsc: "test", 919e41f4b71Sopenharmony_ci pdu: "xxxxxx", 920e41f4b71Sopenharmony_ci status: sms.SimMessageStatus.SIM_MESSAGE_STATUS_READ 921e41f4b71Sopenharmony_ci}; 922e41f4b71Sopenharmony_cisms.addSimMessage(simMessageOptions, (err: BusinessError) => { 923e41f4b71Sopenharmony_ci console.log(`callback: err->${JSON.stringify(err)}`); 924e41f4b71Sopenharmony_ci}); 925e41f4b71Sopenharmony_ci``` 926e41f4b71Sopenharmony_ci 927e41f4b71Sopenharmony_ci 928e41f4b71Sopenharmony_ci## sms.addSimMessage<sup>7+</sup> 929e41f4b71Sopenharmony_ci 930e41f4b71Sopenharmony_ciaddSimMessage\(options: SimMessageOptions\): Promise\<void\> 931e41f4b71Sopenharmony_ci 932e41f4b71Sopenharmony_ciAdds a message to the SIM card. If the SIM card is full, an error is reported. This API uses a promise to return the result. 933e41f4b71Sopenharmony_ci 934e41f4b71Sopenharmony_ci**System API**: This is a system API. 935e41f4b71Sopenharmony_ci 936e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES 937e41f4b71Sopenharmony_ci 938e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 939e41f4b71Sopenharmony_ci 940e41f4b71Sopenharmony_ci**Parameters** 941e41f4b71Sopenharmony_ci 942e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 943e41f4b71Sopenharmony_ci| ------- | ---------------------------------------- | ---- | --------------- | 944e41f4b71Sopenharmony_ci| options | [SimMessageOptions](#simmessageoptions7) | Yes | SIM message options.| 945e41f4b71Sopenharmony_ci 946e41f4b71Sopenharmony_ci**Return value** 947e41f4b71Sopenharmony_ci 948e41f4b71Sopenharmony_ci| Type | Description | 949e41f4b71Sopenharmony_ci| ------------------- | ----------------------------- | 950e41f4b71Sopenharmony_ci| Promise<void> | Promise used to return the result.| 951e41f4b71Sopenharmony_ci 952e41f4b71Sopenharmony_ci**Error codes** 953e41f4b71Sopenharmony_ci 954e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 955e41f4b71Sopenharmony_ci 956e41f4b71Sopenharmony_ci| ID| Error Message | 957e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 958e41f4b71Sopenharmony_ci| 201 | Permission denied. | 959e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 960e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed. | 961e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 962e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 963e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 964e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 965e41f4b71Sopenharmony_ci 966e41f4b71Sopenharmony_ci**Example** 967e41f4b71Sopenharmony_ci 968e41f4b71Sopenharmony_ci```ts 969e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 970e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 971e41f4b71Sopenharmony_ci 972e41f4b71Sopenharmony_cilet simMessageOptions: sms.SimMessageOptions = { 973e41f4b71Sopenharmony_ci slotId: 0, 974e41f4b71Sopenharmony_ci smsc: "test", 975e41f4b71Sopenharmony_ci pdu: "xxxxxx", 976e41f4b71Sopenharmony_ci status: sms.SimMessageStatus.SIM_MESSAGE_STATUS_READ 977e41f4b71Sopenharmony_ci}; 978e41f4b71Sopenharmony_cisms.addSimMessage(simMessageOptions).then(() => { 979e41f4b71Sopenharmony_ci console.log(`addSimMessage success.`); 980e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 981e41f4b71Sopenharmony_ci console.error(`addSimMessage failed, promise: err->${JSON.stringify(err)}`); 982e41f4b71Sopenharmony_ci}); 983e41f4b71Sopenharmony_ci``` 984e41f4b71Sopenharmony_ci 985e41f4b71Sopenharmony_ci## sms.delSimMessage<sup>7+</sup> 986e41f4b71Sopenharmony_ci 987e41f4b71Sopenharmony_cidelSimMessage\(slotId: number, msgIndex: number, callback: AsyncCallback\<void\>\): void 988e41f4b71Sopenharmony_ci 989e41f4b71Sopenharmony_ciDeletes a message from the SIM card. If the specified **msgIndex** is invalid, an error is reported. This API uses an asynchronous callback to return the result. 990e41f4b71Sopenharmony_ci 991e41f4b71Sopenharmony_ci**System API**: This is a system API. 992e41f4b71Sopenharmony_ci 993e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES 994e41f4b71Sopenharmony_ci 995e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 996e41f4b71Sopenharmony_ci 997e41f4b71Sopenharmony_ci**Parameters** 998e41f4b71Sopenharmony_ci 999e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1000e41f4b71Sopenharmony_ci| -------- | ------------------------- | ---- | ----------------------------------------- | 1001e41f4b71Sopenharmony_ci| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| 1002e41f4b71Sopenharmony_ci| msgIndex | number | Yes | Message index. | 1003e41f4b71Sopenharmony_ci| callback | AsyncCallback<void> | Yes | Callback used to return the result. | 1004e41f4b71Sopenharmony_ci 1005e41f4b71Sopenharmony_ci**Error codes** 1006e41f4b71Sopenharmony_ci 1007e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 1008e41f4b71Sopenharmony_ci 1009e41f4b71Sopenharmony_ci| ID| Error Message | 1010e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 1011e41f4b71Sopenharmony_ci| 201 | Permission denied. | 1012e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 1013e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 1014e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 1015e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 1016e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 1017e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 1018e41f4b71Sopenharmony_ci 1019e41f4b71Sopenharmony_ci**Example** 1020e41f4b71Sopenharmony_ci 1021e41f4b71Sopenharmony_ci```ts 1022e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 1023e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 1024e41f4b71Sopenharmony_ci 1025e41f4b71Sopenharmony_cilet slotId: number = 0; 1026e41f4b71Sopenharmony_cilet msgIndex: number = 1; 1027e41f4b71Sopenharmony_cisms.delSimMessage(slotId, msgIndex, (err: BusinessError) => { 1028e41f4b71Sopenharmony_ci console.log(`callback: err->${JSON.stringify(err)}`); 1029e41f4b71Sopenharmony_ci}); 1030e41f4b71Sopenharmony_ci``` 1031e41f4b71Sopenharmony_ci 1032e41f4b71Sopenharmony_ci 1033e41f4b71Sopenharmony_ci## sms.delSimMessage<sup>7+</sup> 1034e41f4b71Sopenharmony_ci 1035e41f4b71Sopenharmony_cidelSimMessage\(slotId: number, msgIndex: number\): Promise\<void\> 1036e41f4b71Sopenharmony_ci 1037e41f4b71Sopenharmony_ciDeletes a message from the SIM card. If the specified **msgIndex** is invalid, an error is reported. This API uses a promise to return the result. 1038e41f4b71Sopenharmony_ci 1039e41f4b71Sopenharmony_ci**System API**: This is a system API. 1040e41f4b71Sopenharmony_ci 1041e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES 1042e41f4b71Sopenharmony_ci 1043e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1044e41f4b71Sopenharmony_ci 1045e41f4b71Sopenharmony_ci**Parameters** 1046e41f4b71Sopenharmony_ci 1047e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1048e41f4b71Sopenharmony_ci| -------- | ------ | ---- | ----------------------------------------- | 1049e41f4b71Sopenharmony_ci| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| 1050e41f4b71Sopenharmony_ci| msgIndex | number | Yes | Message index. | 1051e41f4b71Sopenharmony_ci 1052e41f4b71Sopenharmony_ci**Return value** 1053e41f4b71Sopenharmony_ci 1054e41f4b71Sopenharmony_ci| Type | Description | 1055e41f4b71Sopenharmony_ci| ------------------- | ----------------------------- | 1056e41f4b71Sopenharmony_ci| Promise<void> | Promise used to return the result.| 1057e41f4b71Sopenharmony_ci 1058e41f4b71Sopenharmony_ci**Error codes** 1059e41f4b71Sopenharmony_ci 1060e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 1061e41f4b71Sopenharmony_ci 1062e41f4b71Sopenharmony_ci| ID| Error Message | 1063e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 1064e41f4b71Sopenharmony_ci| 201 | Permission denied. | 1065e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 1066e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 1067e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 1068e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 1069e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 1070e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 1071e41f4b71Sopenharmony_ci 1072e41f4b71Sopenharmony_ci**Example** 1073e41f4b71Sopenharmony_ci 1074e41f4b71Sopenharmony_ci```ts 1075e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 1076e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 1077e41f4b71Sopenharmony_ci 1078e41f4b71Sopenharmony_cilet slotId: number = 0; 1079e41f4b71Sopenharmony_cilet msgIndex: number = 1; 1080e41f4b71Sopenharmony_cilet promise = sms.delSimMessage(slotId, msgIndex); 1081e41f4b71Sopenharmony_cipromise.then(() => { 1082e41f4b71Sopenharmony_ci console.log(`delSimMessage success.`); 1083e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 1084e41f4b71Sopenharmony_ci console.error(`delSimMessage failed, promise: err->${JSON.stringify(err)}`); 1085e41f4b71Sopenharmony_ci}); 1086e41f4b71Sopenharmony_ci``` 1087e41f4b71Sopenharmony_ci 1088e41f4b71Sopenharmony_ci## sms.updateSimMessage<sup>7+</sup> 1089e41f4b71Sopenharmony_ci 1090e41f4b71Sopenharmony_ciupdateSimMessage\(options: UpdateSimMessageOptions, callback: AsyncCallback\<void\>\): void 1091e41f4b71Sopenharmony_ci 1092e41f4b71Sopenharmony_ciUpdates a SIM message. This API uses an asynchronous callback to return the result. 1093e41f4b71Sopenharmony_ci 1094e41f4b71Sopenharmony_ci**System API**: This is a system API. 1095e41f4b71Sopenharmony_ci 1096e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES 1097e41f4b71Sopenharmony_ci 1098e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1099e41f4b71Sopenharmony_ci 1100e41f4b71Sopenharmony_ci**Parameters** 1101e41f4b71Sopenharmony_ci 1102e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1103e41f4b71Sopenharmony_ci| -------- | ---------------------------------------------------- | ---- | ------------------- | 1104e41f4b71Sopenharmony_ci| options | [UpdateSimMessageOptions](#updatesimmessageoptions7) | Yes | SIM message updating options.| 1105e41f4b71Sopenharmony_ci| callback | AsyncCallback<void> | Yes | Callback used to return the result.| 1106e41f4b71Sopenharmony_ci 1107e41f4b71Sopenharmony_ci**Error codes** 1108e41f4b71Sopenharmony_ci 1109e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 1110e41f4b71Sopenharmony_ci 1111e41f4b71Sopenharmony_ci| ID| Error Message | 1112e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 1113e41f4b71Sopenharmony_ci| 201 | Permission denied. | 1114e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 1115e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed. | 1116e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 1117e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 1118e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 1119e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 1120e41f4b71Sopenharmony_ci 1121e41f4b71Sopenharmony_ci**Example** 1122e41f4b71Sopenharmony_ci 1123e41f4b71Sopenharmony_ci```ts 1124e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 1125e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 1126e41f4b71Sopenharmony_ci 1127e41f4b71Sopenharmony_cilet updateSimMessageOptions: sms.UpdateSimMessageOptions = { 1128e41f4b71Sopenharmony_ci slotId: 0, 1129e41f4b71Sopenharmony_ci msgIndex: 1, 1130e41f4b71Sopenharmony_ci newStatus: sms.SimMessageStatus.SIM_MESSAGE_STATUS_FREE, 1131e41f4b71Sopenharmony_ci pdu: "xxxxxxx", 1132e41f4b71Sopenharmony_ci smsc: "test" 1133e41f4b71Sopenharmony_ci}; 1134e41f4b71Sopenharmony_cisms.updateSimMessage(updateSimMessageOptions, (err: BusinessError) => { 1135e41f4b71Sopenharmony_ci console.log(`callback: err->${JSON.stringify(err)}`); 1136e41f4b71Sopenharmony_ci}); 1137e41f4b71Sopenharmony_ci``` 1138e41f4b71Sopenharmony_ci 1139e41f4b71Sopenharmony_ci 1140e41f4b71Sopenharmony_ci## sms.updateSimMessage<sup>7+</sup> 1141e41f4b71Sopenharmony_ci 1142e41f4b71Sopenharmony_ciupdateSimMessage\(options: UpdateSimMessageOptions\): Promise\<void\> 1143e41f4b71Sopenharmony_ci 1144e41f4b71Sopenharmony_ciUpdates a SIM message. This API uses a promise to return the result. 1145e41f4b71Sopenharmony_ci 1146e41f4b71Sopenharmony_ci**System API**: This is a system API. 1147e41f4b71Sopenharmony_ci 1148e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES 1149e41f4b71Sopenharmony_ci 1150e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1151e41f4b71Sopenharmony_ci 1152e41f4b71Sopenharmony_ci**Parameters** 1153e41f4b71Sopenharmony_ci 1154e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1155e41f4b71Sopenharmony_ci| ------- | ---------------------------------------------------- | ---- | ------------------- | 1156e41f4b71Sopenharmony_ci| options | [UpdateSimMessageOptions](#updatesimmessageoptions7) | Yes | SIM message updating options.| 1157e41f4b71Sopenharmony_ci 1158e41f4b71Sopenharmony_ci**Return value** 1159e41f4b71Sopenharmony_ci 1160e41f4b71Sopenharmony_ci| Type | Description | 1161e41f4b71Sopenharmony_ci| ------------------- | ----------------------------- | 1162e41f4b71Sopenharmony_ci| Promise<void> | Promise used to return the result.| 1163e41f4b71Sopenharmony_ci 1164e41f4b71Sopenharmony_ci**Error codes** 1165e41f4b71Sopenharmony_ci 1166e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 1167e41f4b71Sopenharmony_ci 1168e41f4b71Sopenharmony_ci| ID| Error Message | 1169e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 1170e41f4b71Sopenharmony_ci| 201 | Permission denied. | 1171e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 1172e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed. | 1173e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 1174e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 1175e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 1176e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 1177e41f4b71Sopenharmony_ci 1178e41f4b71Sopenharmony_ci**Example** 1179e41f4b71Sopenharmony_ci 1180e41f4b71Sopenharmony_ci```ts 1181e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 1182e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 1183e41f4b71Sopenharmony_ci 1184e41f4b71Sopenharmony_cilet updateSimMessageOptions: sms.UpdateSimMessageOptions = { 1185e41f4b71Sopenharmony_ci slotId: 0, 1186e41f4b71Sopenharmony_ci msgIndex: 1, 1187e41f4b71Sopenharmony_ci newStatus: sms.SimMessageStatus.SIM_MESSAGE_STATUS_FREE, 1188e41f4b71Sopenharmony_ci pdu: "xxxxxxx", 1189e41f4b71Sopenharmony_ci smsc: "test" 1190e41f4b71Sopenharmony_ci}; 1191e41f4b71Sopenharmony_cilet promise = sms.updateSimMessage(updateSimMessageOptions); 1192e41f4b71Sopenharmony_cipromise.then(() => { 1193e41f4b71Sopenharmony_ci console.log(`updateSimMessage success.`); 1194e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 1195e41f4b71Sopenharmony_ci console.error(`updateSimMessage failed, promise: err->${JSON.stringify(err)}`); 1196e41f4b71Sopenharmony_ci}); 1197e41f4b71Sopenharmony_ci``` 1198e41f4b71Sopenharmony_ci 1199e41f4b71Sopenharmony_ci## sms.getAllSimMessages<sup>7+</sup> 1200e41f4b71Sopenharmony_ci 1201e41f4b71Sopenharmony_cigetAllSimMessages\(slotId: number, callback: AsyncCallback\<Array\<SimShortMessage\>\>\): void 1202e41f4b71Sopenharmony_ci 1203e41f4b71Sopenharmony_ciObtains all SIM card messages. This API uses an asynchronous callback to return the result. 1204e41f4b71Sopenharmony_ci 1205e41f4b71Sopenharmony_ci**System API**: This is a system API. 1206e41f4b71Sopenharmony_ci 1207e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.RECEIVE_SMS 1208e41f4b71Sopenharmony_ci 1209e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1210e41f4b71Sopenharmony_ci 1211e41f4b71Sopenharmony_ci**Parameters** 1212e41f4b71Sopenharmony_ci 1213e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1214e41f4b71Sopenharmony_ci| -------- | ----------------------------------------------------------- | ---- | ----------------------------------------- | 1215e41f4b71Sopenharmony_ci| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| 1216e41f4b71Sopenharmony_ci| callback | AsyncCallback<Array<[SimShortMessage](#simshortmessage7)\>> | Yes | Callback used to return the result. | 1217e41f4b71Sopenharmony_ci 1218e41f4b71Sopenharmony_ci**Error codes** 1219e41f4b71Sopenharmony_ci 1220e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 1221e41f4b71Sopenharmony_ci 1222e41f4b71Sopenharmony_ci| ID| Error Message | 1223e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 1224e41f4b71Sopenharmony_ci| 201 | Permission denied. | 1225e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 1226e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 1227e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 1228e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 1229e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 1230e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 1231e41f4b71Sopenharmony_ci 1232e41f4b71Sopenharmony_ci**Example** 1233e41f4b71Sopenharmony_ci 1234e41f4b71Sopenharmony_ci```ts 1235e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 1236e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 1237e41f4b71Sopenharmony_ci 1238e41f4b71Sopenharmony_cilet slotId: number = 0; 1239e41f4b71Sopenharmony_cisms.getAllSimMessages(slotId, (err: BusinessError, data: sms.SimShortMessage[]) => { 1240e41f4b71Sopenharmony_ci console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 1241e41f4b71Sopenharmony_ci}); 1242e41f4b71Sopenharmony_ci``` 1243e41f4b71Sopenharmony_ci 1244e41f4b71Sopenharmony_ci 1245e41f4b71Sopenharmony_ci## sms.getAllSimMessages<sup>7+</sup> 1246e41f4b71Sopenharmony_ci 1247e41f4b71Sopenharmony_cigetAllSimMessages\(slotId: number\): Promise\<Array\<SimShortMessage\>\> 1248e41f4b71Sopenharmony_ci 1249e41f4b71Sopenharmony_ciObtains all SIM card messages. This API uses a promise to return the result. 1250e41f4b71Sopenharmony_ci 1251e41f4b71Sopenharmony_ci**System API**: This is a system API. 1252e41f4b71Sopenharmony_ci 1253e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.RECEIVE_SMS 1254e41f4b71Sopenharmony_ci 1255e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1256e41f4b71Sopenharmony_ci 1257e41f4b71Sopenharmony_ci**Parameters** 1258e41f4b71Sopenharmony_ci 1259e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 1260e41f4b71Sopenharmony_ci| ------ | ------ | ---- | ----------------------------------------- | 1261e41f4b71Sopenharmony_ci| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| 1262e41f4b71Sopenharmony_ci 1263e41f4b71Sopenharmony_ci**Return value** 1264e41f4b71Sopenharmony_ci 1265e41f4b71Sopenharmony_ci| Type | Description | 1266e41f4b71Sopenharmony_ci| ------------------------------------------------------- | ---------------------------------- | 1267e41f4b71Sopenharmony_ci| Promise<Array<[SimShortMessage](#simshortmessage7)\>> | Promise used to return the result.| 1268e41f4b71Sopenharmony_ci 1269e41f4b71Sopenharmony_ci**Error codes** 1270e41f4b71Sopenharmony_ci 1271e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 1272e41f4b71Sopenharmony_ci 1273e41f4b71Sopenharmony_ci| ID| Error Message | 1274e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 1275e41f4b71Sopenharmony_ci| 201 | Permission denied. | 1276e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 1277e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 1278e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 1279e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 1280e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 1281e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 1282e41f4b71Sopenharmony_ci 1283e41f4b71Sopenharmony_ci**Example** 1284e41f4b71Sopenharmony_ci 1285e41f4b71Sopenharmony_ci```ts 1286e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 1287e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 1288e41f4b71Sopenharmony_ci 1289e41f4b71Sopenharmony_cilet slotId: number = 0; 1290e41f4b71Sopenharmony_cilet promise = sms.getAllSimMessages(slotId); 1291e41f4b71Sopenharmony_cipromise.then((data: sms.SimShortMessage[]) => { 1292e41f4b71Sopenharmony_ci console.log(`getAllSimMessages success, promise: data->${JSON.stringify(data)}`); 1293e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 1294e41f4b71Sopenharmony_ci console.error(`getAllSimMessages failed, promise: err->${JSON.stringify(err)}`); 1295e41f4b71Sopenharmony_ci}); 1296e41f4b71Sopenharmony_ci``` 1297e41f4b71Sopenharmony_ci 1298e41f4b71Sopenharmony_ci## sms.setCBConfig<sup>7+</sup> 1299e41f4b71Sopenharmony_ci 1300e41f4b71Sopenharmony_cisetCBConfig\(options: CBConfigOptions, callback: AsyncCallback\<void\>\): void 1301e41f4b71Sopenharmony_ci 1302e41f4b71Sopenharmony_ciSets the cell broadcast configuration. This API uses an asynchronous callback to return the result. 1303e41f4b71Sopenharmony_ci 1304e41f4b71Sopenharmony_ci**System API**: This is a system API. 1305e41f4b71Sopenharmony_ci 1306e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.RECEIVE_SMS 1307e41f4b71Sopenharmony_ci 1308e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1309e41f4b71Sopenharmony_ci 1310e41f4b71Sopenharmony_ci**Parameters** 1311e41f4b71Sopenharmony_ci 1312e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1313e41f4b71Sopenharmony_ci| -------- | ------------------------------------ | ---- | ------------ | 1314e41f4b71Sopenharmony_ci| options | [CBConfigOptions](#cbconfigoptions7) | Yes | Cell broadcast configuration options.| 1315e41f4b71Sopenharmony_ci| callback | AsyncCallback<void> | Yes | Callback used to return the result. | 1316e41f4b71Sopenharmony_ci 1317e41f4b71Sopenharmony_ci**Error codes** 1318e41f4b71Sopenharmony_ci 1319e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 1320e41f4b71Sopenharmony_ci 1321e41f4b71Sopenharmony_ci| ID| Error Message | 1322e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 1323e41f4b71Sopenharmony_ci| 201 | Permission denied. | 1324e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 1325e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 1326e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 1327e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 1328e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 1329e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 1330e41f4b71Sopenharmony_ci 1331e41f4b71Sopenharmony_ci**Example** 1332e41f4b71Sopenharmony_ci 1333e41f4b71Sopenharmony_ci```ts 1334e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 1335e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 1336e41f4b71Sopenharmony_ci 1337e41f4b71Sopenharmony_cilet cbConfigOptions: sms.CBConfigOptions = { 1338e41f4b71Sopenharmony_ci slotId: 0, 1339e41f4b71Sopenharmony_ci enable: true, 1340e41f4b71Sopenharmony_ci startMessageId: 100, 1341e41f4b71Sopenharmony_ci endMessageId: 200, 1342e41f4b71Sopenharmony_ci ranType: sms.RanType.TYPE_GSM 1343e41f4b71Sopenharmony_ci}; 1344e41f4b71Sopenharmony_cisms.setCBConfig(cbConfigOptions, (err: BusinessError) => { 1345e41f4b71Sopenharmony_ci console.log(`callback: err->${JSON.stringify(err)}`); 1346e41f4b71Sopenharmony_ci}); 1347e41f4b71Sopenharmony_ci``` 1348e41f4b71Sopenharmony_ci 1349e41f4b71Sopenharmony_ci 1350e41f4b71Sopenharmony_ci## sms.setCBConfig<sup>7+</sup> 1351e41f4b71Sopenharmony_ci 1352e41f4b71Sopenharmony_cisetCBConfig\(options: CBConfigOptions\): Promise\<void\> 1353e41f4b71Sopenharmony_ci 1354e41f4b71Sopenharmony_ciSets the cell broadcast configuration. This API uses a promise to return the result. 1355e41f4b71Sopenharmony_ci 1356e41f4b71Sopenharmony_ci**System API**: This is a system API. 1357e41f4b71Sopenharmony_ci 1358e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.RECEIVE_SMS 1359e41f4b71Sopenharmony_ci 1360e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1361e41f4b71Sopenharmony_ci 1362e41f4b71Sopenharmony_ci**Parameters** 1363e41f4b71Sopenharmony_ci 1364e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1365e41f4b71Sopenharmony_ci| ------- | ------------------------------------ | ---- | ------------ | 1366e41f4b71Sopenharmony_ci| options | [CBConfigOptions](#cbconfigoptions7) | Yes | Cell broadcast configuration options.| 1367e41f4b71Sopenharmony_ci 1368e41f4b71Sopenharmony_ci**Return value** 1369e41f4b71Sopenharmony_ci 1370e41f4b71Sopenharmony_ci| Type | Description | 1371e41f4b71Sopenharmony_ci| ------------------- | ----------------------------- | 1372e41f4b71Sopenharmony_ci| Promise<void> | Promise used to return the result.| 1373e41f4b71Sopenharmony_ci 1374e41f4b71Sopenharmony_ci**Error codes** 1375e41f4b71Sopenharmony_ci 1376e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 1377e41f4b71Sopenharmony_ci 1378e41f4b71Sopenharmony_ci| ID| Error Message | 1379e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 1380e41f4b71Sopenharmony_ci| 201 | Permission denied. | 1381e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 1382e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 1383e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 1384e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 1385e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 1386e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 1387e41f4b71Sopenharmony_ci 1388e41f4b71Sopenharmony_ci**Example** 1389e41f4b71Sopenharmony_ci 1390e41f4b71Sopenharmony_ci```ts 1391e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 1392e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 1393e41f4b71Sopenharmony_ci 1394e41f4b71Sopenharmony_cilet cbConfigOptions: sms.CBConfigOptions = { 1395e41f4b71Sopenharmony_ci slotId: 0, 1396e41f4b71Sopenharmony_ci enable: true, 1397e41f4b71Sopenharmony_ci startMessageId: 100, 1398e41f4b71Sopenharmony_ci endMessageId: 200, 1399e41f4b71Sopenharmony_ci ranType: sms.RanType.TYPE_GSM 1400e41f4b71Sopenharmony_ci}; 1401e41f4b71Sopenharmony_cilet promise = sms.setCBConfig(cbConfigOptions); 1402e41f4b71Sopenharmony_cipromise.then(() => { 1403e41f4b71Sopenharmony_ci console.log(`setCBConfig success.`); 1404e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 1405e41f4b71Sopenharmony_ci console.error(`setCBConfig failed, promise: err->${JSON.stringify(err)}`); 1406e41f4b71Sopenharmony_ci}); 1407e41f4b71Sopenharmony_ci``` 1408e41f4b71Sopenharmony_ci 1409e41f4b71Sopenharmony_ci## sms.getSmsSegmentsInfo<sup>8+</sup> 1410e41f4b71Sopenharmony_ci 1411e41f4b71Sopenharmony_cigetSmsSegmentsInfo\(slotId: number, message: string, force7bit: boolean, callback: AsyncCallback\<SmsSegmentsInfo\>\): void 1412e41f4b71Sopenharmony_ci 1413e41f4b71Sopenharmony_ciObtains SMS message segment information. This API uses an asynchronous callback to return the result. 1414e41f4b71Sopenharmony_ci 1415e41f4b71Sopenharmony_ci**System API**: This is a system API. 1416e41f4b71Sopenharmony_ci 1417e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1418e41f4b71Sopenharmony_ci 1419e41f4b71Sopenharmony_ci**Parameters** 1420e41f4b71Sopenharmony_ci 1421e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1422e41f4b71Sopenharmony_ci| --------- | ------------------------------------------------------------ | ---- | ----------------------------------------- | 1423e41f4b71Sopenharmony_ci| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| 1424e41f4b71Sopenharmony_ci| message | string | Yes | SMS message. | 1425e41f4b71Sopenharmony_ci| force7bit | boolean | Yes | Whether to use 7-bit coding. | 1426e41f4b71Sopenharmony_ci| callback | AsyncCallback<[SmsSegmentsInfo](#smssegmentsinfo8)> | Yes | Callback used to return the result. | 1427e41f4b71Sopenharmony_ci 1428e41f4b71Sopenharmony_ci**Error codes** 1429e41f4b71Sopenharmony_ci 1430e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 1431e41f4b71Sopenharmony_ci 1432e41f4b71Sopenharmony_ci| ID| Error Message | 1433e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 1434e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 1435e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed. | 1436e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 1437e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 1438e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 1439e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 1440e41f4b71Sopenharmony_ci 1441e41f4b71Sopenharmony_ci**Example** 1442e41f4b71Sopenharmony_ci 1443e41f4b71Sopenharmony_ci```ts 1444e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 1445e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 1446e41f4b71Sopenharmony_ci 1447e41f4b71Sopenharmony_cilet slotId: number = 0; 1448e41f4b71Sopenharmony_cisms.getSmsSegmentsInfo(slotId, "message", false, (err: BusinessError, data: sms.SmsSegmentsInfo) => { 1449e41f4b71Sopenharmony_ci console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 1450e41f4b71Sopenharmony_ci}); 1451e41f4b71Sopenharmony_ci``` 1452e41f4b71Sopenharmony_ci 1453e41f4b71Sopenharmony_ci 1454e41f4b71Sopenharmony_ci## sms.getSmsSegmentsInfo<sup>8+</sup> 1455e41f4b71Sopenharmony_ci 1456e41f4b71Sopenharmony_cigetSmsSegmentsInfo\(slotId: number, message: string, force7bit: boolean\): Promise\<SmsSegmentsInfo\> 1457e41f4b71Sopenharmony_ci 1458e41f4b71Sopenharmony_ciObtains SMS message segment information. This API uses a promise to return the result. 1459e41f4b71Sopenharmony_ci 1460e41f4b71Sopenharmony_ci**System API**: This is a system API. 1461e41f4b71Sopenharmony_ci 1462e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1463e41f4b71Sopenharmony_ci 1464e41f4b71Sopenharmony_ci**Parameters** 1465e41f4b71Sopenharmony_ci 1466e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1467e41f4b71Sopenharmony_ci| --------- | ------- | ---- | ----------------------------------------- | 1468e41f4b71Sopenharmony_ci| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| 1469e41f4b71Sopenharmony_ci| message | string | Yes | SMS message. | 1470e41f4b71Sopenharmony_ci| force7bit | boolean | Yes | Whether to use 7-bit coding. | 1471e41f4b71Sopenharmony_ci 1472e41f4b71Sopenharmony_ci**Return value** 1473e41f4b71Sopenharmony_ci 1474e41f4b71Sopenharmony_ci| Type | Description | 1475e41f4b71Sopenharmony_ci| ------------------------------------------------------- | ----------------------------- | 1476e41f4b71Sopenharmony_ci| Promise<[SmsSegmentsInfo](#smssegmentsinfo8)> | Promise used to return the result.| 1477e41f4b71Sopenharmony_ci 1478e41f4b71Sopenharmony_ci**Error codes** 1479e41f4b71Sopenharmony_ci 1480e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 1481e41f4b71Sopenharmony_ci 1482e41f4b71Sopenharmony_ci| ID| Error Message | 1483e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 1484e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 1485e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed. | 1486e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 1487e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 1488e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 1489e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 1490e41f4b71Sopenharmony_ci 1491e41f4b71Sopenharmony_ci**Example** 1492e41f4b71Sopenharmony_ci 1493e41f4b71Sopenharmony_ci```ts 1494e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 1495e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 1496e41f4b71Sopenharmony_ci 1497e41f4b71Sopenharmony_cilet slotId: number = 0; 1498e41f4b71Sopenharmony_cilet promise = sms.getSmsSegmentsInfo(slotId, "message", false); 1499e41f4b71Sopenharmony_cipromise.then((data: sms.SmsSegmentsInfo) => { 1500e41f4b71Sopenharmony_ci console.log(`getSmsSegmentsInfo success, promise: data->${JSON.stringify(data)}`); 1501e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 1502e41f4b71Sopenharmony_ci console.error(`getSmsSegmentsInfo failed, promise: err->${JSON.stringify(err)}`); 1503e41f4b71Sopenharmony_ci}); 1504e41f4b71Sopenharmony_ci``` 1505e41f4b71Sopenharmony_ci 1506e41f4b71Sopenharmony_ci## sms.isImsSmsSupported<sup>8+</sup> 1507e41f4b71Sopenharmony_ci 1508e41f4b71Sopenharmony_ciisImsSmsSupported\(slotId: number, callback: AsyncCallback\<boolean\>\): void 1509e41f4b71Sopenharmony_ci 1510e41f4b71Sopenharmony_ciChecks whether SMS is supported on IMS. This API uses an asynchronous callback to return the result. 1511e41f4b71Sopenharmony_ci 1512e41f4b71Sopenharmony_ci**System API**: This is a system API. 1513e41f4b71Sopenharmony_ci 1514e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1515e41f4b71Sopenharmony_ci 1516e41f4b71Sopenharmony_ci**Parameters** 1517e41f4b71Sopenharmony_ci 1518e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1519e41f4b71Sopenharmony_ci| -------- | ---------------------------- | ---- | ---------- | 1520e41f4b71Sopenharmony_ci| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| 1521e41f4b71Sopenharmony_ci| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.| 1522e41f4b71Sopenharmony_ci 1523e41f4b71Sopenharmony_ci**Error codes** 1524e41f4b71Sopenharmony_ci 1525e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 1526e41f4b71Sopenharmony_ci 1527e41f4b71Sopenharmony_ci| ID| Error Message | 1528e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 1529e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 1530e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 1531e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 1532e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 1533e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 1534e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 1535e41f4b71Sopenharmony_ci 1536e41f4b71Sopenharmony_ci**Example** 1537e41f4b71Sopenharmony_ci 1538e41f4b71Sopenharmony_ci```ts 1539e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 1540e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 1541e41f4b71Sopenharmony_ci 1542e41f4b71Sopenharmony_cilet slotId: number = 0; 1543e41f4b71Sopenharmony_cisms.isImsSmsSupported(slotId, (err: BusinessError, data: boolean) => { 1544e41f4b71Sopenharmony_ci console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 1545e41f4b71Sopenharmony_ci}); 1546e41f4b71Sopenharmony_ci``` 1547e41f4b71Sopenharmony_ci 1548e41f4b71Sopenharmony_ci 1549e41f4b71Sopenharmony_ci## sms.isImsSmsSupported<sup>8+</sup> 1550e41f4b71Sopenharmony_ci 1551e41f4b71Sopenharmony_ciisImsSmsSupported\(slotId: number\): Promise\<boolean\> 1552e41f4b71Sopenharmony_ci 1553e41f4b71Sopenharmony_ciChecks whether SMS is supported on IMS. This API uses a promise to return the result. 1554e41f4b71Sopenharmony_ci 1555e41f4b71Sopenharmony_ci**System API**: This is a system API. 1556e41f4b71Sopenharmony_ci 1557e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1558e41f4b71Sopenharmony_ci 1559e41f4b71Sopenharmony_ci**Parameters** 1560e41f4b71Sopenharmony_ci 1561e41f4b71Sopenharmony_ci| Name| Type | Mandatory | Description | 1562e41f4b71Sopenharmony_ci| ------ | ------ | ---- | -------------------------------------- | 1563e41f4b71Sopenharmony_ci| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 1564e41f4b71Sopenharmony_ci 1565e41f4b71Sopenharmony_ci**Return value** 1566e41f4b71Sopenharmony_ci 1567e41f4b71Sopenharmony_ci| Type | Description | 1568e41f4b71Sopenharmony_ci| ---------------------- | ----------------------- | 1569e41f4b71Sopenharmony_ci| Promise<boolean> | Promise used to return the result.| 1570e41f4b71Sopenharmony_ci 1571e41f4b71Sopenharmony_ci**Error codes** 1572e41f4b71Sopenharmony_ci 1573e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 1574e41f4b71Sopenharmony_ci 1575e41f4b71Sopenharmony_ci| ID| Error Message | 1576e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 1577e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 1578e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 1579e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 1580e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 1581e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 1582e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 1583e41f4b71Sopenharmony_ci 1584e41f4b71Sopenharmony_ci**Example** 1585e41f4b71Sopenharmony_ci 1586e41f4b71Sopenharmony_ci```ts 1587e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 1588e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 1589e41f4b71Sopenharmony_ci 1590e41f4b71Sopenharmony_cilet slotId: number = 0; 1591e41f4b71Sopenharmony_cilet promise = sms.isImsSmsSupported(slotId); 1592e41f4b71Sopenharmony_cipromise.then((data: boolean) => { 1593e41f4b71Sopenharmony_ci console.log(`isImsSmsSupported success, promise: data->${JSON.stringify(data)}`); 1594e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 1595e41f4b71Sopenharmony_ci console.error(`isImsSmsSupported failed, promise: err->${JSON.stringify(err)}`); 1596e41f4b71Sopenharmony_ci}); 1597e41f4b71Sopenharmony_ci``` 1598e41f4b71Sopenharmony_ci 1599e41f4b71Sopenharmony_ci## sms.getImsShortMessageFormat<sup>8+</sup> 1600e41f4b71Sopenharmony_ci 1601e41f4b71Sopenharmony_cigetImsShortMessageFormat\(callback: AsyncCallback\<string\>\): void 1602e41f4b71Sopenharmony_ci 1603e41f4b71Sopenharmony_ciObtains the SMS format supported by the IMS, for example, **3gpp**, **3gpp2**, or **unknown**. This API uses an asynchronous callback to return the result. 1604e41f4b71Sopenharmony_ci 1605e41f4b71Sopenharmony_ci**System API**: This is a system API. 1606e41f4b71Sopenharmony_ci 1607e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1608e41f4b71Sopenharmony_ci 1609e41f4b71Sopenharmony_ci**Parameters** 1610e41f4b71Sopenharmony_ci 1611e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1612e41f4b71Sopenharmony_ci| -------- | --------------------------- | ---- | ---------- | 1613e41f4b71Sopenharmony_ci| callback | AsyncCallback<string> | Yes | Callback used to return the result.| 1614e41f4b71Sopenharmony_ci 1615e41f4b71Sopenharmony_ci**Error codes** 1616e41f4b71Sopenharmony_ci 1617e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 1618e41f4b71Sopenharmony_ci 1619e41f4b71Sopenharmony_ci| ID| Error Message | 1620e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 1621e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 1622e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. | 1623e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 1624e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 1625e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 1626e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 1627e41f4b71Sopenharmony_ci 1628e41f4b71Sopenharmony_ci**Example** 1629e41f4b71Sopenharmony_ci 1630e41f4b71Sopenharmony_ci```ts 1631e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 1632e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 1633e41f4b71Sopenharmony_ci 1634e41f4b71Sopenharmony_cisms.getImsShortMessageFormat((err: BusinessError, data: string) => { 1635e41f4b71Sopenharmony_ci console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 1636e41f4b71Sopenharmony_ci}); 1637e41f4b71Sopenharmony_ci``` 1638e41f4b71Sopenharmony_ci 1639e41f4b71Sopenharmony_ci 1640e41f4b71Sopenharmony_ci## sms.getImsShortMessageFormat<sup>8+</sup> 1641e41f4b71Sopenharmony_ci 1642e41f4b71Sopenharmony_cigetImsShortMessageFormat\(\): Promise\<string\> 1643e41f4b71Sopenharmony_ci 1644e41f4b71Sopenharmony_ciObtains the SMS format supported by the IMS, for example, **3gpp**, **3gpp2**, or **unknown**. This API uses a promise to return the result. 1645e41f4b71Sopenharmony_ci 1646e41f4b71Sopenharmony_ci**System API**: This is a system API. 1647e41f4b71Sopenharmony_ci 1648e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1649e41f4b71Sopenharmony_ci 1650e41f4b71Sopenharmony_ci**Return value** 1651e41f4b71Sopenharmony_ci 1652e41f4b71Sopenharmony_ci| Type | Description | 1653e41f4b71Sopenharmony_ci| --------------------- | -------------------------- | 1654e41f4b71Sopenharmony_ci| Promise<string> | Promise used to return the result. | 1655e41f4b71Sopenharmony_ci 1656e41f4b71Sopenharmony_ci**Error codes** 1657e41f4b71Sopenharmony_ci 1658e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 1659e41f4b71Sopenharmony_ci 1660e41f4b71Sopenharmony_ci| ID| Error Message | 1661e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 1662e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 1663e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 1664e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 1665e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 1666e41f4b71Sopenharmony_ci 1667e41f4b71Sopenharmony_ci**Example** 1668e41f4b71Sopenharmony_ci 1669e41f4b71Sopenharmony_ci```ts 1670e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 1671e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 1672e41f4b71Sopenharmony_ci 1673e41f4b71Sopenharmony_cisms.getImsShortMessageFormat().then((data: string) => { 1674e41f4b71Sopenharmony_ci console.log(`getImsShortMessageFormat success, promise: data->${JSON.stringify(data)}`); 1675e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 1676e41f4b71Sopenharmony_ci console.error(`getImsShortMessageFormat failed, promise: err->${JSON.stringify(err)}`); 1677e41f4b71Sopenharmony_ci}); 1678e41f4b71Sopenharmony_ci``` 1679e41f4b71Sopenharmony_ci 1680e41f4b71Sopenharmony_ci## sms.decodeMms<sup>8+</sup> 1681e41f4b71Sopenharmony_ci 1682e41f4b71Sopenharmony_cidecodeMms\(mmsFilePathName: string | Array\<number\>, callback: AsyncCallback\<MmsInformation\>\): void 1683e41f4b71Sopenharmony_ci 1684e41f4b71Sopenharmony_ciDecodes MMS messages. This API uses an asynchronous callback to return the result. 1685e41f4b71Sopenharmony_ci 1686e41f4b71Sopenharmony_ci**System API**: This is a system API. 1687e41f4b71Sopenharmony_ci 1688e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1689e41f4b71Sopenharmony_ci 1690e41f4b71Sopenharmony_ci**Parameters** 1691e41f4b71Sopenharmony_ci 1692e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1693e41f4b71Sopenharmony_ci| --------------- | ------------------------------------------------------- | ---- | -------------- | 1694e41f4b71Sopenharmony_ci| mmsFilePathName | string \|Array<number\> | Yes | MMS message file path.| 1695e41f4b71Sopenharmony_ci| callback | AsyncCallback<[MmsInformation](#mmsinformation8)> | Yes | Callback used to return the result, which is carried in {@code MmsInformation}. | 1696e41f4b71Sopenharmony_ci 1697e41f4b71Sopenharmony_ci**Error codes** 1698e41f4b71Sopenharmony_ci 1699e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 1700e41f4b71Sopenharmony_ci 1701e41f4b71Sopenharmony_ci| ID| Error Message | 1702e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 1703e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 1704e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed. | 1705e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 1706e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 1707e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 1708e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 1709e41f4b71Sopenharmony_ci 1710e41f4b71Sopenharmony_ci**Example** 1711e41f4b71Sopenharmony_ci 1712e41f4b71Sopenharmony_ci```ts 1713e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 1714e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 1715e41f4b71Sopenharmony_ci 1716e41f4b71Sopenharmony_cilet mmsFilePathName: string = "filename"; 1717e41f4b71Sopenharmony_cisms.decodeMms(mmsFilePathName, (err: BusinessError, data: sms.MmsInformation) => { 1718e41f4b71Sopenharmony_ci console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 1719e41f4b71Sopenharmony_ci}); 1720e41f4b71Sopenharmony_ci 1721e41f4b71Sopenharmony_ciconst mmsPdu: Array<number> = [0x8c, 0x80, 0x98, 0x31, 0x00, 0x8d, 0x92, 0x89, 0x09, 0x80, 0x07, 0xea, 0x31, 0x30, 0x30, 0x38, 0x36, 0x00, 0x97, 0x07, 0xea, 0x31, 0x30, 0x30,0x31, 0x30, 0x00, 0x84, 0x74, 0x79, 0x70, 0x65, 0x00, 0x00]; 1722e41f4b71Sopenharmony_cisms.decodeMms(mmsPdu, (err: BusinessError, data: sms.MmsInformation) => { 1723e41f4b71Sopenharmony_ci console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 1724e41f4b71Sopenharmony_ci}); 1725e41f4b71Sopenharmony_ci``` 1726e41f4b71Sopenharmony_ci 1727e41f4b71Sopenharmony_ci 1728e41f4b71Sopenharmony_ci## sms.decodeMms<sup>8+</sup> 1729e41f4b71Sopenharmony_ci 1730e41f4b71Sopenharmony_cidecodeMms\(mmsFilePathName: string | Array\<number\>\): Promise\<MmsInformation\> 1731e41f4b71Sopenharmony_ci 1732e41f4b71Sopenharmony_ciDecodes MMS messages. This API uses a promise to return the result. 1733e41f4b71Sopenharmony_ci 1734e41f4b71Sopenharmony_ci**System API**: This is a system API. 1735e41f4b71Sopenharmony_ci 1736e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1737e41f4b71Sopenharmony_ci 1738e41f4b71Sopenharmony_ci**Parameters** 1739e41f4b71Sopenharmony_ci 1740e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1741e41f4b71Sopenharmony_ci| --------------- | ----------------------- | ---- | -------------- | 1742e41f4b71Sopenharmony_ci| mmsFilePathName | string \|Array<number\> | Yes | MMS message file path.| 1743e41f4b71Sopenharmony_ci 1744e41f4b71Sopenharmony_ci**Return value** 1745e41f4b71Sopenharmony_ci 1746e41f4b71Sopenharmony_ci| Type | Description | 1747e41f4b71Sopenharmony_ci| --------------------------------------------------------- | --------------------------- | 1748e41f4b71Sopenharmony_ci| Promise<<[MmsInformation](#mmsinformation8)>> | Promise used to return the result.| 1749e41f4b71Sopenharmony_ci 1750e41f4b71Sopenharmony_ci**Error codes** 1751e41f4b71Sopenharmony_ci 1752e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 1753e41f4b71Sopenharmony_ci 1754e41f4b71Sopenharmony_ci| ID| Error Message | 1755e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 1756e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 1757e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed. | 1758e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 1759e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 1760e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 1761e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 1762e41f4b71Sopenharmony_ci 1763e41f4b71Sopenharmony_ci**Example** 1764e41f4b71Sopenharmony_ci 1765e41f4b71Sopenharmony_ci```ts 1766e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 1767e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 1768e41f4b71Sopenharmony_ci 1769e41f4b71Sopenharmony_cilet mmsFilePathName: string = "filename"; 1770e41f4b71Sopenharmony_cilet promise = sms.decodeMms(mmsFilePathName); 1771e41f4b71Sopenharmony_cipromise.then((data: sms.MmsInformation) => { 1772e41f4b71Sopenharmony_ci console.log(`decodeMms success, promise: data->${JSON.stringify(data)}`); 1773e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 1774e41f4b71Sopenharmony_ci console.error(`decodeMms failed, promise: err->${JSON.stringify(err)}`); 1775e41f4b71Sopenharmony_ci}); 1776e41f4b71Sopenharmony_ci 1777e41f4b71Sopenharmony_ciconst mmsPdu: Array<number> = [0x8c, 0x80, 0x98, 0x31, 0x00, 0x8d, 0x92, 0x89, 0x09, 0x80, 0x07, 0xea, 0x31, 0x30, 0x30, 0x38, 0x36, 0x00, 0x97, 0x07, 0xea, 0x31, 0x30, 0x30,0x31, 0x30, 0x00, 0x84, 0x74, 0x79, 0x70, 0x65, 0x00, 0x00]; 1778e41f4b71Sopenharmony_cilet promiseArr = sms.decodeMms(mmsPdu); 1779e41f4b71Sopenharmony_cipromiseArr.then((data: sms.MmsInformation) => { 1780e41f4b71Sopenharmony_ci console.log(`decodeMms success, promise: data->${JSON.stringify(data)}`); 1781e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 1782e41f4b71Sopenharmony_ci console.error(`decodeMms failed, promise: err->${JSON.stringify(err)}`); 1783e41f4b71Sopenharmony_ci}); 1784e41f4b71Sopenharmony_ci``` 1785e41f4b71Sopenharmony_ci 1786e41f4b71Sopenharmony_ci## sms.encodeMms<sup>8+</sup> 1787e41f4b71Sopenharmony_ci 1788e41f4b71Sopenharmony_ciencodeMms\(mms: MmsInformation, callback: AsyncCallback\<Array\<number\>\>\): void 1789e41f4b71Sopenharmony_ci 1790e41f4b71Sopenharmony_ciMMS message code. This API uses an asynchronous callback to return the result. 1791e41f4b71Sopenharmony_ci 1792e41f4b71Sopenharmony_ci**System API**: This is a system API. 1793e41f4b71Sopenharmony_ci 1794e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1795e41f4b71Sopenharmony_ci 1796e41f4b71Sopenharmony_ci**Parameters** 1797e41f4b71Sopenharmony_ci 1798e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1799e41f4b71Sopenharmony_ci| -------- | ----------------------------------- | ---- | ---------- | 1800e41f4b71Sopenharmony_ci| mms | [MmsInformation](#mmsinformation8) | Yes | MMS message information.| 1801e41f4b71Sopenharmony_ci| callback | AsyncCallback<Array<number\>> | Yes | Callback used to return the result.| 1802e41f4b71Sopenharmony_ci 1803e41f4b71Sopenharmony_ci**Error codes** 1804e41f4b71Sopenharmony_ci 1805e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 1806e41f4b71Sopenharmony_ci 1807e41f4b71Sopenharmony_ci| ID| Error Message | 1808e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 1809e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 1810e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed. | 1811e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 1812e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 1813e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 1814e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 1815e41f4b71Sopenharmony_ci 1816e41f4b71Sopenharmony_ci**Example** 1817e41f4b71Sopenharmony_ci 1818e41f4b71Sopenharmony_ci```ts 1819e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 1820e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 1821e41f4b71Sopenharmony_ci 1822e41f4b71Sopenharmony_cilet mmsAcknowledgeInd: sms.MmsAcknowledgeInd = { 1823e41f4b71Sopenharmony_ci transactionId: "100", 1824e41f4b71Sopenharmony_ci version: sms.MmsVersionType.MMS_VERSION_1_0, 1825e41f4b71Sopenharmony_ci reportAllowed: sms.ReportType.MMS_YES 1826e41f4b71Sopenharmony_ci}; 1827e41f4b71Sopenharmony_cilet mmsInformation: sms.MmsInformation = { 1828e41f4b71Sopenharmony_ci messageType: sms.MessageType.TYPE_MMS_ACKNOWLEDGE_IND, 1829e41f4b71Sopenharmony_ci mmsType: mmsAcknowledgeInd 1830e41f4b71Sopenharmony_ci}; 1831e41f4b71Sopenharmony_cisms.encodeMms(mmsInformation, (err: BusinessError, data: number[]) => { 1832e41f4b71Sopenharmony_ci console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 1833e41f4b71Sopenharmony_ci}); 1834e41f4b71Sopenharmony_ci``` 1835e41f4b71Sopenharmony_ci 1836e41f4b71Sopenharmony_ci 1837e41f4b71Sopenharmony_ci## sms.encodeMms<sup>8+</sup> 1838e41f4b71Sopenharmony_ci 1839e41f4b71Sopenharmony_ciencodeMms\(mms: MmsInformation\): Promise\<Array\<number\>\> 1840e41f4b71Sopenharmony_ci 1841e41f4b71Sopenharmony_ciMMS message code. This API uses a promise to return the result. 1842e41f4b71Sopenharmony_ci 1843e41f4b71Sopenharmony_ci**System API**: This is a system API. 1844e41f4b71Sopenharmony_ci 1845e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1846e41f4b71Sopenharmony_ci 1847e41f4b71Sopenharmony_ci**Parameters** 1848e41f4b71Sopenharmony_ci 1849e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 1850e41f4b71Sopenharmony_ci| ------ | ---------------------------------- | ---- | ---------- | 1851e41f4b71Sopenharmony_ci| mms | [MmsInformation](#mmsinformation8) | Yes | MMS message information.| 1852e41f4b71Sopenharmony_ci 1853e41f4b71Sopenharmony_ci**Return value** 1854e41f4b71Sopenharmony_ci 1855e41f4b71Sopenharmony_ci| Type | Description | 1856e41f4b71Sopenharmony_ci| ----------------------------- | ----------------------------------- | 1857e41f4b71Sopenharmony_ci| Promise<Array<number\>> | Promise used to return the result.| 1858e41f4b71Sopenharmony_ci 1859e41f4b71Sopenharmony_ci**Error codes** 1860e41f4b71Sopenharmony_ci 1861e41f4b71Sopenharmony_ciFor details about the error codes, see [Telephony Error Codes](errorcode-telephony.md). 1862e41f4b71Sopenharmony_ci 1863e41f4b71Sopenharmony_ci| ID| Error Message | 1864e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | 1865e41f4b71Sopenharmony_ci| 202 | Non-system applications use system APIs. | 1866e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed. | 1867e41f4b71Sopenharmony_ci| 8300001 | Invalid parameter value. | 1868e41f4b71Sopenharmony_ci| 8300002 | Operation failed. Cannot connect to service. | 1869e41f4b71Sopenharmony_ci| 8300003 | System internal error. | 1870e41f4b71Sopenharmony_ci| 8300999 | Unknown error code. | 1871e41f4b71Sopenharmony_ci 1872e41f4b71Sopenharmony_ci**Example** 1873e41f4b71Sopenharmony_ci 1874e41f4b71Sopenharmony_ci```ts 1875e41f4b71Sopenharmony_ciimport { sms } from '@kit.TelephonyKit'; 1876e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 1877e41f4b71Sopenharmony_ci 1878e41f4b71Sopenharmony_cilet mmsAcknowledgeInd: sms.MmsAcknowledgeInd = { 1879e41f4b71Sopenharmony_ci transactionId: "100", 1880e41f4b71Sopenharmony_ci version: sms.MmsVersionType.MMS_VERSION_1_0, 1881e41f4b71Sopenharmony_ci reportAllowed: sms.ReportType.MMS_YES 1882e41f4b71Sopenharmony_ci}; 1883e41f4b71Sopenharmony_cilet mmsInformation: sms.MmsInformation = { 1884e41f4b71Sopenharmony_ci messageType: sms.MessageType.TYPE_MMS_ACKNOWLEDGE_IND, 1885e41f4b71Sopenharmony_ci mmsType: mmsAcknowledgeInd 1886e41f4b71Sopenharmony_ci}; 1887e41f4b71Sopenharmony_cisms.encodeMms(mmsInformation).then((data: number[]) => { 1888e41f4b71Sopenharmony_ci console.log(`encodeMms success, promise: data->${JSON.stringify(data)}`); 1889e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 1890e41f4b71Sopenharmony_ci console.error(`encodeMms failed, promise: err->${JSON.stringify(err)}`); 1891e41f4b71Sopenharmony_ci}); 1892e41f4b71Sopenharmony_ci``` 1893e41f4b71Sopenharmony_ci 1894e41f4b71Sopenharmony_ci 1895e41f4b71Sopenharmony_ci## MmsParams<sup>11+</sup> 1896e41f4b71Sopenharmony_ci 1897e41f4b71Sopenharmony_ciDefines the parameters for sending SMS messages. 1898e41f4b71Sopenharmony_ci 1899e41f4b71Sopenharmony_ci**System API**: This is a system API. 1900e41f4b71Sopenharmony_ci 1901e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1902e41f4b71Sopenharmony_ci 1903e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1904e41f4b71Sopenharmony_ci| ---------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 1905e41f4b71Sopenharmony_ci| slotId<sup>11+</sup> | number | Yes | Slot ID of the SIM card used for sending SMS messages. <br>- **0**: card slot 1<br>- **1**: card slot 2 | 1906e41f4b71Sopenharmony_ci| mmsc<sup>11+</sup> | string | Yes | MMSC address. | 1907e41f4b71Sopenharmony_ci| data<sup>11+</sup> | string | Yes | MMS PDU address.| 1908e41f4b71Sopenharmony_ci| mmsConfig<sup>11+</sup> | MmsConfig | No | MMS configuration file. For details, see [MmsParams](#mmsparams11). | 1909e41f4b71Sopenharmony_ci 1910e41f4b71Sopenharmony_ci## MmsConfig<sup>11+</sup> 1911e41f4b71Sopenharmony_ci 1912e41f4b71Sopenharmony_ciMMS configuration file. 1913e41f4b71Sopenharmony_ci 1914e41f4b71Sopenharmony_ci**System API**: This is a system API. 1915e41f4b71Sopenharmony_ci 1916e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1917e41f4b71Sopenharmony_ci 1918e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1919e41f4b71Sopenharmony_ci| ---------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 1920e41f4b71Sopenharmony_ci| userAgent<sup>11+</sup> | string | Yes | User agent. | 1921e41f4b71Sopenharmony_ci| userAgentProfile<sup>11+</sup> | string | Yes | User agent profile. | 1922e41f4b71Sopenharmony_ci 1923e41f4b71Sopenharmony_ci 1924e41f4b71Sopenharmony_ci 1925e41f4b71Sopenharmony_ci## MmsInformation<sup>8+</sup> 1926e41f4b71Sopenharmony_ci 1927e41f4b71Sopenharmony_ciDefines the MMS message information. 1928e41f4b71Sopenharmony_ci 1929e41f4b71Sopenharmony_ci**System API**: This is a system API. 1930e41f4b71Sopenharmony_ci 1931e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1932e41f4b71Sopenharmony_ci 1933e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1934e41f4b71Sopenharmony_ci| ----------- | ------------------------------------------------------------ | ---- | ---------- | 1935e41f4b71Sopenharmony_ci| messageType | [MessageType](#messagetype8) | Yes | Message type.| 1936e41f4b71Sopenharmony_ci| mmsType | [MmsSendReq](#mmssendreq8) \|[MmsSendConf](#mmssendconf8) \|[MmsNotificationInd](#mmsnotificationind8) \|[MmsRespInd](#mmsrespind8) \|[MmsRetrieveConf](#mmsretrieveconf8)\|[MmsAcknowledgeInd](#mmsacknowledgeind8)\|[MmsDeliveryInd](#mmsdeliveryind8)\|[MmsReadOrigInd](#mmsreadorigind8)\|[MmsReadRecInd](#mmsreadrecind8) | Yes | PDU header type.| 1937e41f4b71Sopenharmony_ci| attachment | Array<[MmsAttachment](#mmsattachment8)\> | No | Attachment. | 1938e41f4b71Sopenharmony_ci 1939e41f4b71Sopenharmony_ci## MmsSendReq<sup>8+</sup> 1940e41f4b71Sopenharmony_ci 1941e41f4b71Sopenharmony_ciDefines an MMS message sending request. 1942e41f4b71Sopenharmony_ci 1943e41f4b71Sopenharmony_ci**System API**: This is a system API. 1944e41f4b71Sopenharmony_ci 1945e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1946e41f4b71Sopenharmony_ci 1947e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1948e41f4b71Sopenharmony_ci| ---------------- | ------------------------------------ | ---- | ------------ | 1949e41f4b71Sopenharmony_ci| from | [MmsAddress](#mmsaddress8) | Yes | MMS message source. | 1950e41f4b71Sopenharmony_ci| transactionId | string | Yes | Transaction ID. | 1951e41f4b71Sopenharmony_ci| contentType | string | Yes | Content type. | 1952e41f4b71Sopenharmony_ci| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | 1953e41f4b71Sopenharmony_ci| to | Array<[MmsAddress](#mmsaddress8)\> | No | Destination address. | 1954e41f4b71Sopenharmony_ci| date | number | No | Date. | 1955e41f4b71Sopenharmony_ci| cc | Array<[MmsAddress](#mmsaddress8)\> | No | Carbon copy. | 1956e41f4b71Sopenharmony_ci| bcc | Array<[MmsAddress](#mmsaddress8)\> | No | Blind carbon copy. | 1957e41f4b71Sopenharmony_ci| subject | string | No | Subject. | 1958e41f4b71Sopenharmony_ci| messageClass | number | No | Message class. | 1959e41f4b71Sopenharmony_ci| expiry | number | No | Expiration. | 1960e41f4b71Sopenharmony_ci| priority | [MmsPriorityType](#mmsprioritytype8) | No | Priority. | 1961e41f4b71Sopenharmony_ci| senderVisibility | number | No | Sender visibility.| 1962e41f4b71Sopenharmony_ci| deliveryReport | number | No | Delivery report. | 1963e41f4b71Sopenharmony_ci| readReport | number | No | Read report. | 1964e41f4b71Sopenharmony_ci 1965e41f4b71Sopenharmony_ci## MmsSendConf<sup>8+</sup> 1966e41f4b71Sopenharmony_ci 1967e41f4b71Sopenharmony_ciDefines the MMS message sending configuration. 1968e41f4b71Sopenharmony_ci 1969e41f4b71Sopenharmony_ci**System API**: This is a system API. 1970e41f4b71Sopenharmony_ci 1971e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1972e41f4b71Sopenharmony_ci 1973e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1974e41f4b71Sopenharmony_ci| ------------- | ---------------------------------- | ---- | -------- | 1975e41f4b71Sopenharmony_ci| responseState | number | Yes | Response status.| 1976e41f4b71Sopenharmony_ci| transactionId | string | Yes | Transaction ID. | 1977e41f4b71Sopenharmony_ci| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | 1978e41f4b71Sopenharmony_ci| messageId | string | No | Message ID. | 1979e41f4b71Sopenharmony_ci 1980e41f4b71Sopenharmony_ci## MmsNotificationInd<sup>8+</sup> 1981e41f4b71Sopenharmony_ci 1982e41f4b71Sopenharmony_ciDefines an MMS notification index. 1983e41f4b71Sopenharmony_ci 1984e41f4b71Sopenharmony_ci**System API**: This is a system API. 1985e41f4b71Sopenharmony_ci 1986e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 1987e41f4b71Sopenharmony_ci 1988e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1989e41f4b71Sopenharmony_ci| --------------- | ---------------------------------- | ---- | -------- | 1990e41f4b71Sopenharmony_ci| transactionId | string | Yes | Transaction ID. | 1991e41f4b71Sopenharmony_ci| messageClass | number | Yes | Message class. | 1992e41f4b71Sopenharmony_ci| messageSize | number | Yes | Message size.| 1993e41f4b71Sopenharmony_ci| expiry | number | Yes | Expiration. | 1994e41f4b71Sopenharmony_ci| contentLocation | string | Yes | Content location.| 1995e41f4b71Sopenharmony_ci| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | 1996e41f4b71Sopenharmony_ci| from | [MmsAddress](#mmsaddress8) | No | Source address. | 1997e41f4b71Sopenharmony_ci| subject | string | No | Subject. | 1998e41f4b71Sopenharmony_ci| deliveryReport | number | No | Status report.| 1999e41f4b71Sopenharmony_ci| contentClass | number | No | Content class. | 2000e41f4b71Sopenharmony_ci 2001e41f4b71Sopenharmony_ci## MmsAcknowledgeInd<sup>8+</sup> 2002e41f4b71Sopenharmony_ci 2003e41f4b71Sopenharmony_ciDefines an MMS confirmation index. 2004e41f4b71Sopenharmony_ci 2005e41f4b71Sopenharmony_ci**System API**: This is a system API. 2006e41f4b71Sopenharmony_ci 2007e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 2008e41f4b71Sopenharmony_ci 2009e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 2010e41f4b71Sopenharmony_ci| ------------- | ---------------------------------- | ---- | -------- | 2011e41f4b71Sopenharmony_ci| transactionId | string | Yes | Transaction ID. | 2012e41f4b71Sopenharmony_ci| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | 2013e41f4b71Sopenharmony_ci| reportAllowed | [ReportType](#reporttype8) | No | Report allowed.| 2014e41f4b71Sopenharmony_ci 2015e41f4b71Sopenharmony_ci## MmsRetrieveConf<sup>8+</sup> 2016e41f4b71Sopenharmony_ci 2017e41f4b71Sopenharmony_ciDefines the MMS message retrieval configuration. 2018e41f4b71Sopenharmony_ci 2019e41f4b71Sopenharmony_ci**System API**: This is a system API. 2020e41f4b71Sopenharmony_ci 2021e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 2022e41f4b71Sopenharmony_ci 2023e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 2024e41f4b71Sopenharmony_ci| -------------- | ------------------------------------ | ---- | -------- | 2025e41f4b71Sopenharmony_ci| transactionId | string | Yes | Transaction ID. | 2026e41f4b71Sopenharmony_ci| messageId | string | Yes | Message ID. | 2027e41f4b71Sopenharmony_ci| date | number | Yes | Date. | 2028e41f4b71Sopenharmony_ci| contentType | string | Yes | Content type.| 2029e41f4b71Sopenharmony_ci| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address. | 2030e41f4b71Sopenharmony_ci| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | 2031e41f4b71Sopenharmony_ci| from | [MmsAddress](#mmsaddress8) | No | Source address. | 2032e41f4b71Sopenharmony_ci| cc | Array<[MmsAddress](#mmsaddress8)\> | No | Carbon copy. | 2033e41f4b71Sopenharmony_ci| subject | string | No | Subject. | 2034e41f4b71Sopenharmony_ci| priority | [MmsPriorityType](#mmsprioritytype8) | No | Priority. | 2035e41f4b71Sopenharmony_ci| deliveryReport | number | No | Status report.| 2036e41f4b71Sopenharmony_ci| readReport | number | No | Read report.| 2037e41f4b71Sopenharmony_ci| retrieveStatus | number | No | Retrieval status.| 2038e41f4b71Sopenharmony_ci| retrieveText | string | No | Retrieval text.| 2039e41f4b71Sopenharmony_ci 2040e41f4b71Sopenharmony_ci## MmsReadOrigInd<sup>8+</sup> 2041e41f4b71Sopenharmony_ci 2042e41f4b71Sopenharmony_ciDefines the original MMS message reading index. 2043e41f4b71Sopenharmony_ci 2044e41f4b71Sopenharmony_ci**System API**: This is a system API. 2045e41f4b71Sopenharmony_ci 2046e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 2047e41f4b71Sopenharmony_ci 2048e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 2049e41f4b71Sopenharmony_ci| ---------- | ---------------------------------- | ---- | -------- | 2050e41f4b71Sopenharmony_ci| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | 2051e41f4b71Sopenharmony_ci| messageId | string | Yes | Message ID. | 2052e41f4b71Sopenharmony_ci| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address. | 2053e41f4b71Sopenharmony_ci| from | [MmsAddress](#mmsaddress8) | Yes | Source address. | 2054e41f4b71Sopenharmony_ci| date | number | Yes | Date. | 2055e41f4b71Sopenharmony_ci| readStatus | number | Yes | Read status.| 2056e41f4b71Sopenharmony_ci 2057e41f4b71Sopenharmony_ci## MmsReadRecInd<sup>8+</sup> 2058e41f4b71Sopenharmony_ci 2059e41f4b71Sopenharmony_ciDefines the MMS message reading index. 2060e41f4b71Sopenharmony_ci 2061e41f4b71Sopenharmony_ci**System API**: This is a system API. 2062e41f4b71Sopenharmony_ci 2063e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 2064e41f4b71Sopenharmony_ci 2065e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 2066e41f4b71Sopenharmony_ci| ---------- | ---------------------------------- | ---- | -------- | 2067e41f4b71Sopenharmony_ci| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | 2068e41f4b71Sopenharmony_ci| messageId | string | Yes | Message ID. | 2069e41f4b71Sopenharmony_ci| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address. | 2070e41f4b71Sopenharmony_ci| from | [MmsAddress](#mmsaddress8) | Yes | Source address. | 2071e41f4b71Sopenharmony_ci| readStatus | number | Yes | Read status.| 2072e41f4b71Sopenharmony_ci| date | number | No | Date. | 2073e41f4b71Sopenharmony_ci 2074e41f4b71Sopenharmony_ci## MmsAttachment<sup>8+</sup> 2075e41f4b71Sopenharmony_ci 2076e41f4b71Sopenharmony_ciDefines the attachment of an MMS message. 2077e41f4b71Sopenharmony_ci 2078e41f4b71Sopenharmony_ci**System API**: This is a system API. 2079e41f4b71Sopenharmony_ci 2080e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 2081e41f4b71Sopenharmony_ci 2082e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 2083e41f4b71Sopenharmony_ci| ----------------------- | ------------------------------------ | ---- | ------------------ | 2084e41f4b71Sopenharmony_ci| contentId | string | Yes | Content ID. | 2085e41f4b71Sopenharmony_ci| contentLocation | string | Yes | Content location. | 2086e41f4b71Sopenharmony_ci| contentDisposition | [DispositionType](#dispositiontype8) | Yes | Content disposition. | 2087e41f4b71Sopenharmony_ci| contentTransferEncoding | string | Yes | Encoding for content transfer. | 2088e41f4b71Sopenharmony_ci| contentType | string | Yes | Content type. | 2089e41f4b71Sopenharmony_ci| isSmil | boolean | Yes | Whether the synchronized multimedia integration language is used.| 2090e41f4b71Sopenharmony_ci| path | string | No | Path. | 2091e41f4b71Sopenharmony_ci| inBuff | Array<number\> | No | Whether the message is in the buffer. | 2092e41f4b71Sopenharmony_ci| fileName | string | No | File name. | 2093e41f4b71Sopenharmony_ci| charset | [MmsCharSets](#mmscharsets8) | No | Character set. | 2094e41f4b71Sopenharmony_ci 2095e41f4b71Sopenharmony_ci## MmsAddress<sup>8+</sup> 2096e41f4b71Sopenharmony_ci 2097e41f4b71Sopenharmony_ciDefines an MMSC address. 2098e41f4b71Sopenharmony_ci 2099e41f4b71Sopenharmony_ci**System API**: This is a system API. 2100e41f4b71Sopenharmony_ci 2101e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 2102e41f4b71Sopenharmony_ci 2103e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 2104e41f4b71Sopenharmony_ci| ------- | ---------------------------- | ---- | ------ | 2105e41f4b71Sopenharmony_ci| address | string | Yes | Network address. | 2106e41f4b71Sopenharmony_ci| charset | [MmsCharSets](#mmscharsets8) | Yes | Character set.| 2107e41f4b71Sopenharmony_ci 2108e41f4b71Sopenharmony_ci## MessageType<sup>8+</sup> 2109e41f4b71Sopenharmony_ci 2110e41f4b71Sopenharmony_ciMessage type. 2111e41f4b71Sopenharmony_ci 2112e41f4b71Sopenharmony_ci**System API**: This is a system API. 2113e41f4b71Sopenharmony_ci 2114e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 2115e41f4b71Sopenharmony_ci 2116e41f4b71Sopenharmony_ci| Name | Value | Description | 2117e41f4b71Sopenharmony_ci| ------------------------- | ---- | -------------------- | 2118e41f4b71Sopenharmony_ci| TYPE_MMS_SEND_REQ | 128 | MMS message sending request. | 2119e41f4b71Sopenharmony_ci| TYPE_MMS_SEND_CONF | 129 | MMS message sending configuration. | 2120e41f4b71Sopenharmony_ci| TYPE_MMS_NOTIFICATION_IND | 130 | MMS notification index. | 2121e41f4b71Sopenharmony_ci| TYPE_MMS_RESP_IND | 131 | MMS message response index. | 2122e41f4b71Sopenharmony_ci| TYPE_MMS_RETRIEVE_CONF | 132 | MMS message retrieval configuration. | 2123e41f4b71Sopenharmony_ci| TYPE_MMS_ACKNOWLEDGE_IND | 133 | MMS message acknowledgement index. | 2124e41f4b71Sopenharmony_ci| TYPE_MMS_DELIVERY_IND | 134 | MMS message delivery index. | 2125e41f4b71Sopenharmony_ci| TYPE_MMS_READ_REC_IND | 135 | MMS message reading and receiving index.| 2126e41f4b71Sopenharmony_ci| TYPE_MMS_READ_ORIG_IND | 136 | Original MMS message reading index.| 2127e41f4b71Sopenharmony_ci 2128e41f4b71Sopenharmony_ci## MmsPriorityType<sup>8+</sup> 2129e41f4b71Sopenharmony_ci 2130e41f4b71Sopenharmony_ciEnumerates MMS message priorities. 2131e41f4b71Sopenharmony_ci 2132e41f4b71Sopenharmony_ci**System API**: This is a system API. 2133e41f4b71Sopenharmony_ci 2134e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 2135e41f4b71Sopenharmony_ci 2136e41f4b71Sopenharmony_ci| Name | Value | Description | 2137e41f4b71Sopenharmony_ci| ---------- | ---- | -------------- | 2138e41f4b71Sopenharmony_ci| MMS_LOW | 128 | Low priority. | 2139e41f4b71Sopenharmony_ci| MMS_NORMAL | 129 | Normal priority.| 2140e41f4b71Sopenharmony_ci| MMS_HIGH | 130 | High priority. | 2141e41f4b71Sopenharmony_ci 2142e41f4b71Sopenharmony_ci## MmsVersionType<sup>8+</sup> 2143e41f4b71Sopenharmony_ci 2144e41f4b71Sopenharmony_ciEnumerates MMS versions. 2145e41f4b71Sopenharmony_ci 2146e41f4b71Sopenharmony_ci**System API**: This is a system API. 2147e41f4b71Sopenharmony_ci 2148e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 2149e41f4b71Sopenharmony_ci 2150e41f4b71Sopenharmony_ci| Name | Value | Description | 2151e41f4b71Sopenharmony_ci| --------------- | ---- | ----------- | 2152e41f4b71Sopenharmony_ci| MMS_VERSION_1_0 | 0x10 | MMS version 1_0.| 2153e41f4b71Sopenharmony_ci| MMS_VERSION_1_1 | 0x11 | MMS version 1_1.| 2154e41f4b71Sopenharmony_ci| MMS_VERSION_1_2 | 0x12 | MMS version 1_2.| 2155e41f4b71Sopenharmony_ci| MMS_VERSION_1_3 | 0x13 | MMS version 1_3.| 2156e41f4b71Sopenharmony_ci 2157e41f4b71Sopenharmony_ci## MmsCharSets<sup>8+</sup> 2158e41f4b71Sopenharmony_ci 2159e41f4b71Sopenharmony_ciEnumerates MMS character sets. 2160e41f4b71Sopenharmony_ci 2161e41f4b71Sopenharmony_ci**System API**: This is a system API. 2162e41f4b71Sopenharmony_ci 2163e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 2164e41f4b71Sopenharmony_ci 2165e41f4b71Sopenharmony_ci| Name | Value | Description | 2166e41f4b71Sopenharmony_ci| --------------- | ------ | ------------------- | 2167e41f4b71Sopenharmony_ci| BIG5 | 0X07EA | BIG5 format. | 2168e41f4b71Sopenharmony_ci| ISO_10646_UCS_2 | 0X03E8 | ISO_10646_UCS_2 format.| 2169e41f4b71Sopenharmony_ci| ISO_8859_1 | 0X04 | ISO_8859_1 format. | 2170e41f4b71Sopenharmony_ci| ISO_8859_2 | 0X05 | ISO_8859_2 format. | 2171e41f4b71Sopenharmony_ci| ISO_8859_3 | 0X06 | ISO_8859_3 format. | 2172e41f4b71Sopenharmony_ci| ISO_8859_4 | 0X07 | ISO_8859_4 format. | 2173e41f4b71Sopenharmony_ci| ISO_8859_5 | 0X08 | ISO_8859_5 format. | 2174e41f4b71Sopenharmony_ci| ISO_8859_6 | 0X09 | ISO_8859_6 format. | 2175e41f4b71Sopenharmony_ci| ISO_8859_7 | 0X0A | ISO_8859_7 format. | 2176e41f4b71Sopenharmony_ci| ISO_8859_8 | 0X0B | ISO_8859_8 format. | 2177e41f4b71Sopenharmony_ci| ISO_8859_9 | 0X0C | ISO_8859_9 format. | 2178e41f4b71Sopenharmony_ci| SHIFT_JIS | 0X11 | SHIFT_JIS format. | 2179e41f4b71Sopenharmony_ci| US_ASCII | 0X03 | US_ASCII format. | 2180e41f4b71Sopenharmony_ci| UTF_8 | 0X6A | UTF_8 format. | 2181e41f4b71Sopenharmony_ci 2182e41f4b71Sopenharmony_ci## DispositionType<sup>8+</sup> 2183e41f4b71Sopenharmony_ci 2184e41f4b71Sopenharmony_ciEnumerates disposition types. 2185e41f4b71Sopenharmony_ci 2186e41f4b71Sopenharmony_ci**System API**: This is a system API. 2187e41f4b71Sopenharmony_ci 2188e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 2189e41f4b71Sopenharmony_ci 2190e41f4b71Sopenharmony_ci| Name | Value | Description | 2191e41f4b71Sopenharmony_ci| ---------- | ---- | -------- | 2192e41f4b71Sopenharmony_ci| FROM_DATA | 0 | Data source.| 2193e41f4b71Sopenharmony_ci| ATTACHMENT | 1 | Attachment. | 2194e41f4b71Sopenharmony_ci| INLINE | 2 | Inlining. | 2195e41f4b71Sopenharmony_ci 2196e41f4b71Sopenharmony_ci## ReportType<sup>8+</sup> 2197e41f4b71Sopenharmony_ci 2198e41f4b71Sopenharmony_ciEnumerates report types. 2199e41f4b71Sopenharmony_ci 2200e41f4b71Sopenharmony_ci**System API**: This is a system API. 2201e41f4b71Sopenharmony_ci 2202e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 2203e41f4b71Sopenharmony_ci 2204e41f4b71Sopenharmony_ci| Name | Value | Description| 2205e41f4b71Sopenharmony_ci| ------- | ---- | ---- | 2206e41f4b71Sopenharmony_ci| MMS_YES | 128 | YES | 2207e41f4b71Sopenharmony_ci| MMS_NO | 129 | NO | 2208e41f4b71Sopenharmony_ci 2209e41f4b71Sopenharmony_ci## CBConfigOptions<sup>7+</sup> 2210e41f4b71Sopenharmony_ci 2211e41f4b71Sopenharmony_ciDefines the cell broadcast configuration options. 2212e41f4b71Sopenharmony_ci 2213e41f4b71Sopenharmony_ci**System API**: This is a system API. 2214e41f4b71Sopenharmony_ci 2215e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 2216e41f4b71Sopenharmony_ci 2217e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 2218e41f4b71Sopenharmony_ci| -------------- | -------------------- | ---- | ------------ | 2219e41f4b71Sopenharmony_ci| slotId | number | Yes | Card slot ID. | 2220e41f4b71Sopenharmony_ci| enable | boolean | Yes | Whether to enable cell broadcast. | 2221e41f4b71Sopenharmony_ci| startMessageId | number | Yes | Start message ID. | 2222e41f4b71Sopenharmony_ci| endMessageId | number | Yes | End message ID. | 2223e41f4b71Sopenharmony_ci| ranType | [RanType](#rantype7) | Yes | RAN type.| 2224e41f4b71Sopenharmony_ci 2225e41f4b71Sopenharmony_ci## SimMessageStatus<sup>7+</sup> 2226e41f4b71Sopenharmony_ci 2227e41f4b71Sopenharmony_ciDefines the SIM message status. 2228e41f4b71Sopenharmony_ci 2229e41f4b71Sopenharmony_ci**System API**: This is a system API. 2230e41f4b71Sopenharmony_ci 2231e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 2232e41f4b71Sopenharmony_ci 2233e41f4b71Sopenharmony_ci| Name | Value | Description | 2234e41f4b71Sopenharmony_ci| ------------------------- | ---- | --------------------------- | 2235e41f4b71Sopenharmony_ci| SIM_MESSAGE_STATUS_FREE | 0 | Free space state of the SIM card. | 2236e41f4b71Sopenharmony_ci| SIM_MESSAGE_STATUS_READ | 1 | Read state. | 2237e41f4b71Sopenharmony_ci| SIM_MESSAGE_STATUS_UNREAD | 3 | Unread state. | 2238e41f4b71Sopenharmony_ci| SIM_MESSAGE_STATUS_SENT | 5 | Storage of sent messages (applicable only to SMS).| 2239e41f4b71Sopenharmony_ci| SIM_MESSAGE_STATUS_UNSENT | 7 | Storage of unsent messages (applicable only to SMS).| 2240e41f4b71Sopenharmony_ci 2241e41f4b71Sopenharmony_ci## RanType<sup>7+</sup> 2242e41f4b71Sopenharmony_ci 2243e41f4b71Sopenharmony_ciRAN type. 2244e41f4b71Sopenharmony_ci 2245e41f4b71Sopenharmony_ci**System API**: This is a system API. 2246e41f4b71Sopenharmony_ci 2247e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 2248e41f4b71Sopenharmony_ci 2249e41f4b71Sopenharmony_ci| Name | Value | Description| 2250e41f4b71Sopenharmony_ci| --------- | ---- | ---- | 2251e41f4b71Sopenharmony_ci| TYPE_GSM | 1 | GSM | 2252e41f4b71Sopenharmony_ci| TYPE_CDMA | 2 | CMDA | 2253e41f4b71Sopenharmony_ci 2254e41f4b71Sopenharmony_ci## SmsEncodingScheme<sup>8+</sup> 2255e41f4b71Sopenharmony_ci 2256e41f4b71Sopenharmony_ciEnumerates SMS encoding schemes. 2257e41f4b71Sopenharmony_ci 2258e41f4b71Sopenharmony_ci**System API**: This is a system API. 2259e41f4b71Sopenharmony_ci 2260e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 2261e41f4b71Sopenharmony_ci 2262e41f4b71Sopenharmony_ci| Name | Value | Description | 2263e41f4b71Sopenharmony_ci| -------------------- | ---- | ------------ | 2264e41f4b71Sopenharmony_ci| SMS_ENCODING_UNKNOWN | 0 | Unknown code.| 2265e41f4b71Sopenharmony_ci| SMS_ENCODING_7BIT | 1 | 7-digit code. | 2266e41f4b71Sopenharmony_ci| SMS_ENCODING_8BIT | 2 | 8-digit code. | 2267e41f4b71Sopenharmony_ci| SMS_ENCODING_16BIT | 3 | 16-digit code.| 2268e41f4b71Sopenharmony_ci 2269e41f4b71Sopenharmony_ci## SimMessageOptions<sup>7+</sup> 2270e41f4b71Sopenharmony_ci 2271e41f4b71Sopenharmony_ciDefines the SIM message options. 2272e41f4b71Sopenharmony_ci 2273e41f4b71Sopenharmony_ci**System API**: This is a system API. 2274e41f4b71Sopenharmony_ci 2275e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 2276e41f4b71Sopenharmony_ci 2277e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 2278e41f4b71Sopenharmony_ci| ------ | -------------------------------------- | ---- | -------------- | 2279e41f4b71Sopenharmony_ci| slotId | number | Yes | Card slot ID. | 2280e41f4b71Sopenharmony_ci| smsc | string | Yes | Short message service center.| 2281e41f4b71Sopenharmony_ci| pdu | string | Yes | Protocol data unit. | 2282e41f4b71Sopenharmony_ci| status | [SimMessageStatus](#simmessagestatus7) | Yes | Status. | 2283e41f4b71Sopenharmony_ci 2284e41f4b71Sopenharmony_ci## UpdateSimMessageOptions<sup>7+</sup> 2285e41f4b71Sopenharmony_ci 2286e41f4b71Sopenharmony_ciDefines the updating SIM message options. 2287e41f4b71Sopenharmony_ci 2288e41f4b71Sopenharmony_ci**System API**: This is a system API. 2289e41f4b71Sopenharmony_ci 2290e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 2291e41f4b71Sopenharmony_ci 2292e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 2293e41f4b71Sopenharmony_ci| --------- | -------------------------------------- | ---- | -------------- | 2294e41f4b71Sopenharmony_ci| slotId | number | Yes | Card slot ID. | 2295e41f4b71Sopenharmony_ci| msgIndex | number | Yes | Message index. | 2296e41f4b71Sopenharmony_ci| newStatus | [SimMessageStatus](#simmessagestatus7) | Yes | New status. | 2297e41f4b71Sopenharmony_ci| pdu | string | Yes | Protocol data unit. | 2298e41f4b71Sopenharmony_ci| smsc | string | Yes | Short message service center.| 2299e41f4b71Sopenharmony_ci 2300e41f4b71Sopenharmony_ci## SimShortMessage<sup>7+</sup> 2301e41f4b71Sopenharmony_ci 2302e41f4b71Sopenharmony_ciDefines a SIM message. 2303e41f4b71Sopenharmony_ci 2304e41f4b71Sopenharmony_ci**System API**: This is a system API. 2305e41f4b71Sopenharmony_ci 2306e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 2307e41f4b71Sopenharmony_ci 2308e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 2309e41f4b71Sopenharmony_ci| ---------------- | -------------------------------------- | ---- | ------------- | 2310e41f4b71Sopenharmony_ci| shortMessage | [ShortMessage](js-apis-sms.md#shortmessage) | Yes | SMS message. | 2311e41f4b71Sopenharmony_ci| simMessageStatus | [SimMessageStatus](#simmessagestatus7) | Yes | SIM message status.| 2312e41f4b71Sopenharmony_ci| indexOnSim | number | Yes | SIM card index. | 2313e41f4b71Sopenharmony_ci 2314e41f4b71Sopenharmony_ci## MmsDeliveryInd<sup>8+</sup> 2315e41f4b71Sopenharmony_ci 2316e41f4b71Sopenharmony_ciDefines an MMS message delivery index. 2317e41f4b71Sopenharmony_ci 2318e41f4b71Sopenharmony_ci**System API**: This is a system API. 2319e41f4b71Sopenharmony_ci 2320e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 2321e41f4b71Sopenharmony_ci 2322e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 2323e41f4b71Sopenharmony_ci| --------- | ---------------------------------- | ---- | ------ | 2324e41f4b71Sopenharmony_ci| messageId | string | Yes | Message ID.| 2325e41f4b71Sopenharmony_ci| date | number | Yes | Date. | 2326e41f4b71Sopenharmony_ci| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address.| 2327e41f4b71Sopenharmony_ci| status | number | Yes | Status. | 2328e41f4b71Sopenharmony_ci| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | 2329e41f4b71Sopenharmony_ci 2330e41f4b71Sopenharmony_ci## MmsRespInd<sup>8+</sup> 2331e41f4b71Sopenharmony_ci 2332e41f4b71Sopenharmony_ciDefines an MMS response index. 2333e41f4b71Sopenharmony_ci 2334e41f4b71Sopenharmony_ci**System API**: This is a system API. 2335e41f4b71Sopenharmony_ci 2336e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 2337e41f4b71Sopenharmony_ci 2338e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 2339e41f4b71Sopenharmony_ci| ------------- | ---------------------------------- | ---- | -------- | 2340e41f4b71Sopenharmony_ci| transactionId | string | Yes | Event ID. | 2341e41f4b71Sopenharmony_ci| status | number | Yes | Status. | 2342e41f4b71Sopenharmony_ci| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | 2343e41f4b71Sopenharmony_ci| reportAllowed | [ReportType](#reporttype8) | No | Report allowed.| 2344e41f4b71Sopenharmony_ci 2345e41f4b71Sopenharmony_ci## SmsSegmentsInfo<sup>8+</sup> 2346e41f4b71Sopenharmony_ci 2347e41f4b71Sopenharmony_ciDefines the SMS message segment information. 2348e41f4b71Sopenharmony_ci 2349e41f4b71Sopenharmony_ci**System API**: This is a system API. 2350e41f4b71Sopenharmony_ci 2351e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Telephony.SmsMms 2352e41f4b71Sopenharmony_ci 2353e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 2354e41f4b71Sopenharmony_ci| -------------------- | ---------------------------------------- | ---- | ------------ | 2355e41f4b71Sopenharmony_ci| splitCount | number | Yes | Split count. | 2356e41f4b71Sopenharmony_ci| encodeCount | number | Yes | Encoding count. | 2357e41f4b71Sopenharmony_ci| encodeCountRemaining | number | Yes | Remaining encoding count.| 2358e41f4b71Sopenharmony_ci| scheme | [SmsEncodingScheme](#smsencodingscheme8) | Yes | Encoding scheme.| 2359