1# @ohos.telephony.sms (SMS) 2 3The **sms** module provides basic SMS management functions. You can create and send SMS messages, and obtain and set the default SIM card for sending and receiving SMS messages. Besides, you can obtain and set the SMSC address, and check whether the current device can send and receive SMS messages. 4 5>**NOTE** 6> 7>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. 8 9## Modules to Import 10 11```js 12import sms from '@ohos.telephony.sms'; 13``` 14 15## sms.createMessage 16 17createMessage\(pdu: Array<number>, specification: string, callback: AsyncCallback<ShortMessage\>\): void 18 19Creates an SMS instance based on the protocol data unit (PDU) and specified SMS protocol. This API uses an asynchronous callback to return the result. 20 21**System capability**: SystemCapability.Telephony.SmsMms 22 23**Parameters** 24 25| Name | Type | Mandatory| Description | 26| ------------- | -------------------------------------------------- | ---- | ------------------------------------------------------------ | 27| pdu | Array<number> | Yes | Protocol data unit, which is obtained from the received SMS message. | 28| specification | string | Yes | SMS protocol type. <br>- **3gpp**: GSM/UMTS/LTE SMS<br>- **3gpp2**: CDMA SMS| 29| callback | AsyncCallback<[ShortMessage](#shortmessage)> | Yes | Callback used to return the result. | 30 31**Example** 32 33```js 34const specification = '3gpp'; 35// Display PDUs using numbers in an array, for example, [0x08, 0x91, ...]. 36const pdu = [0x08, 0x91]; 37sms.createMessage(pdu, specification, (err, data) => { 38 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 39}); 40``` 41 42 43## sms.createMessage 44 45createMessage\(pdu: Array<number>, specification: string\): Promise<ShortMessage\> 46 47Creates an SMS instance based on the PDU and specified SMS protocol. This API uses a promise to return the result. 48 49**System capability**: SystemCapability.Telephony.SmsMms 50 51**Parameters** 52 53| Name | Type | Mandatory| Description | 54| ------------- | ------------------- | ---- | ------------------------------------------------------------ | 55| pdu | Array<number> | Yes | Protocol data unit, which is obtained from the received SMS message. | 56| specification | string | Yes | SMS protocol type. <br>- **3gpp**: GSM/UMTS/LTE SMS<br>- **3gpp2**: CDMA SMS| 57 58**Return value** 59 60| Type | Description | 61| -------------------------------------------- | --------------------------------- | 62| Promise<[ShortMessage](#shortmessage)> | Promise used to return the result.| 63 64**Example** 65 66```js 67const specification = '3gpp'; 68// Display PDUs using numbers in an array, for example, [0x08, 0x91, ...]. 69const pdu = [0x08, 0x91]; 70let promise = sms.createMessage(pdu, specification); 71promise.then(data => { 72 console.log(`createMessage success, promise: data->${JSON.stringify(data)}`); 73}).catch(err => { 74 console.error(`createMessage failed, promise: err->${JSON.stringify(err)}`); 75}); 76``` 77 78## sms.sendMessage 79 80sendMessage(options: SendMessageOptions): void 81 82Sends an SMS message. 83 84**Required permissions**: ohos.permission.SEND_MESSAGES 85 86**System capability**: SystemCapability.Telephony.SmsMms 87 88**Parameters** 89 90| Name | Type | Mandatory| Description | 91| ------- | ----------------------------------------- | ---- | ------------------------------------------------------------ | 92| options | [SendMessageOptions](#sendmessageoptions) | Yes | Options (including the callback) for sending an SMS message.| 93 94**Error codes** 95 96For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 97 98| ID| Error Message | 99| -------- | -------------------------------------------- | 100| 201 | Permission denied. | 101| 401 | Parameter error. | 102| 8300001 | Invalid parameter value. | 103| 8300002 | Operation failed. Cannot connect to service. | 104| 8300003 | System internal error. | 105| 8300999 | Unknown error code. | 106 107**Example** 108 109```js 110let sendCallback = function (err, data) { 111 console.log(`sendCallback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 112} 113let deliveryCallback = function (err, data) { 114 console.log(`deliveryCallback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 115} 116let slotId = 0; 117let content ='SMS message content'; 118let destinationHost = '+861xxxxxxxxxx'; 119let serviceCenter = '+861xxxxxxxxxx'; 120let destinationPort = 1000; 121let options = {slotId, content, destinationHost, serviceCenter, destinationPort, sendCallback, deliveryCallback}; 122sms.sendMessage(options); 123``` 124 125 126## sms.getDefaultSmsSlotId<sup>7+</sup> 127 128getDefaultSmsSlotId\(callback: AsyncCallback<number>\): void 129 130Obtains the default slot ID of the SIM card used to send SMS messages. This API uses an asynchronous callback to return the result. 131 132**System capability**: SystemCapability.Telephony.SmsMms 133 134**Parameters** 135 136| Name | Type | Mandatory| Description | 137| -------- | --------------------------- | ---- | ---------------------------------------- | 138| callback | AsyncCallback<number> | Yes | Callback used to return the result.<br>- **0**: card slot 1<br>- **1**: card slot 2| 139 140**Example** 141 142```js 143sms.getDefaultSmsSlotId((err, data) => { 144 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 145}); 146``` 147 148 149## sms.getDefaultSmsSlotId<sup>7+</sup> 150 151getDefaultSmsSlotId\(\): Promise<number> 152 153Obtains the default slot ID of the SIM card used to send SMS messages. This API uses a promise to return the result. 154 155**System capability**: SystemCapability.Telephony.SmsMms 156 157**Return value** 158 159| Type | Description | 160| --------------- | ------------------------------------------------------------ | 161| Promise<number> | Promise used to return the result.<br>- **0**: card slot 1<br>- **1**: card slot 2| 162 163**Example** 164 165```js 166let promise = sms.getDefaultSmsSlotId(); 167promise.then(data => { 168 console.log(`getDefaultSmsSlotId success, promise: data->${JSON.stringify(data)}`); 169}).catch(err => { 170 console.error(`getDefaultSmsSlotId failed, promise: err->${JSON.stringify(err)}`); 171}); 172``` 173 174## sms.setDefaultSmsSlotId<sup>7+</sup> 175 176setDefaultSmsSlotId\(slotId: number, callback: AsyncCallback<void>\): void 177 178Sets the default slot ID of the SIM card used to send SMS messages. This API uses an asynchronous callback to return the result. 179 180**System API**: This is a system API. 181 182**Required permissions**: ohos.permission.SET_TELEPHONY_STATE 183 184**System capability**: SystemCapability.Telephony.SmsMms 185 186**Parameters** 187 188| Name | Type | Mandatory| Description | 189| -------- | ------------------------- | ---- | ------------------------------------------------------------ | 190| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2<br>- **-1**: Clears the default configuration.| 191| callback | AsyncCallback<void> | Yes | Callback used to return the result. | 192 193**Error codes** 194 195For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 196 197| ID| Error Message | 198| -------- | -------------------------------------------- | 199| 201 | Permission denied. | 200| 401 | Parameter error. | 201| 8300001 | Invalid parameter value. | 202| 8300002 | Operation failed. Cannot connect to service. | 203| 8300003 | System internal error. | 204| 8300004 | Do not have sim card. | 205| 8300999 | Unknown error code. | 206 207**Example** 208 209```js 210sms.setDefaultSmsSlotId(0, (err) => { 211 console.log(`callback: err->${JSON.stringify(err)}.`); 212}); 213``` 214 215 216## sms.setDefaultSmsSlotId<sup>7+</sup> 217 218setDefaultSmsSlotId\(slotId: number\): Promise<void> 219 220Sets the default slot ID of the SIM card used to send SMS messages. This API uses a promise to return the result. 221 222**System API**: This is a system API. 223 224**Required permissions**: ohos.permission.SET_TELEPHONY_STATE 225 226**System capability**: SystemCapability.Telephony.SmsMms 227 228**Parameters** 229 230| Name| Type | Mandatory| Description | 231| ------ | ------ | ---- | ------------------------------------------------------------ | 232| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2<br>- **-1**: Clears the default configuration.| 233 234**Return value** 235 236| Type | Description | 237| --------------- | ------------------------------- | 238| Promise\<void\> | Promise used to return the result.| 239 240**Error codes** 241 242For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 243 244| ID| Error Message | 245| -------- | -------------------------------------------- | 246| 201 | Permission denied. | 247| 401 | Parameter error. | 248| 8300001 | Invalid parameter value. | 249| 8300002 | Operation failed. Cannot connect to service. | 250| 8300003 | System internal error. | 251| 8300004 | Do not have sim card. | 252| 8300999 | Unknown error code. | 253 254**Example** 255 256```js 257let promise = sms.setDefaultSmsSlotId(0); 258promise.then(() => { 259 console.log(`setDefaultSmsSlotId success.`); 260}).catch((err) => { 261 console.error(`setDefaultSmsSlotId failed, promise: err->${JSON.stringify(err)}`); 262}); 263``` 264 265## sms.setSmscAddr<sup>7+</sup> 266 267setSmscAddr\(slotId: number, smscAddr: string, callback: AsyncCallback<void\>\): void 268 269Sets the short message service center (SMSC) address. This API uses an asynchronous callback to return the result. 270 271**System API**: This is a system API. 272 273**Required permissions**: ohos.permission.SET_TELEPHONY_STATE (a system permission) 274 275**System capability**: SystemCapability.Telephony.SmsMms 276 277**Parameters** 278 279| Name | Type | Mandatory| Description | 280| -------- | ------------------------- | ---- | ----------------------------------------- | 281| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| 282| smscAddr | string | Yes | SMSC address. | 283| callback | AsyncCallback<void> | Yes | Callback used to return the result. | 284 285**Error codes** 286 287For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 288 289| ID| Error Message | 290| -------- | -------------------------------------------- | 291| 201 | Permission denied. | 292| 401 | Parameter error. | 293| 8300001 | Invalid parameter value. | 294| 8300002 | Operation failed. Cannot connect to service. | 295| 8300003 | System internal error. | 296| 8300999 | Unknown error code. | 297 298**Example** 299 300```js 301let slotId = 0; 302let smscAddr = '+861xxxxxxxxxx'; 303sms.setSmscAddr(slotId, smscAddr, (err) => { 304 console.log(`callback: err->${JSON.stringify(err)}`); 305}); 306``` 307 308 309## sms.setSmscAddr<sup>7+</sup> 310 311setSmscAddr\(slotId: number, smscAddr: string\): Promise\<void\> 312 313Sets the SMSC address. This API uses a promise to return the result. 314 315**System API**: This is a system API. 316 317**Required permissions**: ohos.permission.SET_TELEPHONY_STATE (a system permission) 318 319**System capability**: SystemCapability.Telephony.SmsMms 320 321**Parameters** 322 323| Name | Type | Mandatory| Description | 324| -------- | ------ | ---- | ----------------------------------------- | 325| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| 326| smscAddr | string | Yes | SMSC address. | 327 328**Return value** 329 330| Type | Description | 331| ------------------- | ------------------------------- | 332| Promise<void> | Promise used to return the result.| 333 334**Error codes** 335 336For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 337 338| ID| Error Message | 339| -------- | -------------------------------------------- | 340| 201 | Permission denied. | 341| 401 | Parameter error. | 342| 8300001 | Invalid parameter value. | 343| 8300002 | Operation failed. Cannot connect to service. | 344| 8300003 | System internal error. | 345| 8300999 | Unknown error code. | 346 347**Example** 348 349```js 350let slotId = 0; 351let smscAddr = '+861xxxxxxxxxx'; 352let promise = sms.setSmscAddr(slotId, smscAddr); 353promise.then(() => { 354 console.log(`setSmscAddr success.`); 355}).catch((err) => { 356 console.error(`setSmscAddr failed, promise: err->${JSON.stringify(err)}`); 357}); 358``` 359 360 361## sms.getSmscAddr<sup>7+</sup> 362 363getSmscAddr\(slotId: number, callback: AsyncCallback<string\>\): void 364 365Obtains the SMSC address. This API uses an asynchronous callback to return the result. 366 367**System API**: This is a system API. 368 369**Required permissions**: ohos.permission.GET_TELEPHONY_STATE (a system permission) 370 371**System capability**: SystemCapability.Telephony.SmsMms 372 373**Parameters** 374 375| Name | Type | Mandatory| Description | 376| -------- | --------------------------- | ---- | ----------------------------------------- | 377| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| 378| callback | AsyncCallback<string> | Yes | Callback used to return the result. | 379 380**Error codes** 381 382For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 383 384| ID| Error Message | 385| -------- | -------------------------------------------- | 386| 201 | Permission denied. | 387| 401 | Parameter error. | 388| 8300001 | Invalid parameter value. | 389| 8300002 | Operation failed. Cannot connect to service. | 390| 8300003 | System internal error. | 391| 8300999 | Unknown error code. | 392 393**Example** 394 395```js 396let slotId = 0; 397sms.getSmscAddr(slotId, (err, data) => { 398 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 399}); 400``` 401 402 403## sms.getSmscAddr<sup>7+</sup> 404 405getSmscAddr\(slotId: number\): Promise<string\> 406 407Obtains the SMSC address. This API uses a promise to return the result. 408 409**System API**: This is a system API. 410 411**Required permissions**: ohos.permission.GET_TELEPHONY_STATE (a system permission) 412 413**System capability**: SystemCapability.Telephony.SmsMms 414 415**Parameters** 416 417| Name| Type | Mandatory| Description | 418| ------ | ------ | ---- | ----------------------------------------- | 419| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| 420 421**Return value** 422 423| Type | Description | 424| --------------------- | --------------------------------------------- | 425| Promise<string> | Promise used to return the result.| 426 427**Error codes** 428 429For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 430 431| ID| Error Message | 432| -------- | -------------------------------------------- | 433| 201 | Permission denied. | 434| 401 | Parameter error. | 435| 8300001 | Invalid parameter value. | 436| 8300002 | Operation failed. Cannot connect to service. | 437| 8300003 | System internal error. | 438| 8300999 | Unknown error code. | 439 440**Example** 441 442```js 443let slotId = 0; 444let promise = sms.getSmscAddr(slotId); 445promise.then(data => { 446 console.log(`getSmscAddr success, promise: data->${JSON.stringify(data)}`); 447}).catch(err => { 448 console.error(`getSmscAddr failed, promise: err->${JSON.stringify(err)}`); 449}); 450``` 451 452## sms.hasSmsCapability<sup>7+</sup> 453 454hasSmsCapability(): boolean 455 456Checks whether the current device can send and receive SMS messages. This API works in synchronous mode. 457 458**System capability**: SystemCapability.Telephony.SmsMms 459 460**Return value** 461 462| Type | Description | 463| ------- | ------------------------------------------------------------ | 464| boolean | - **true**: The device can send and receive SMS messages.<br>- **false**: The device cannot send or receive SMS messages.| 465 466```js 467let result = sms.hasSmsCapability(); 468console.log(`hasSmsCapability: ${JSON.stringify(result)}`); 469``` 470 471## sms.splitMessage<sup>8+</sup> 472 473splitMessage(content: string, callback: AsyncCallback<Array<string\>>): void 474 475Splits an SMS message into multiple segments. This API uses an asynchronous callback to return the result. 476 477**System API**: This is a system API. 478 479**Required permissions**: ohos.permission.SEND_MESSAGES 480 481**System capability**: SystemCapability.Telephony.SmsMms 482 483**Parameters** 484 485| Name | Type | Mandatory| Description | 486| -------- | ----------------------------- | ---- | ----------------------------- | 487| content | string | Yes | SMS message content. The value cannot be null.| 488| callback | AsyncCallback<Array<string\>> | Yes | Callback used to return the result. | 489 490**Error codes** 491 492For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 493 494| ID| Error Message | 495| -------- | -------------------------------------------- | 496| 201 | Permission denied. | 497| 401 | Parameter error. | 498| 8300001 | Invalid parameter value. | 499| 8300002 | Operation failed. Cannot connect to service. | 500| 8300003 | System internal error. | 501| 8300999 | Unknown error code. | 502 503**Example** 504 505```js 506let content = "long message"; 507sms.splitMessage(content, (err, data) => { 508 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 509}); 510``` 511 512 513## sms.splitMessage<sup>8+</sup> 514 515splitMessage(content: string): Promise<Array<string\>> 516 517Splits an SMS message into multiple segments. This API uses a promise to return the result. 518 519**System API**: This is a system API. 520 521**Required permissions**: ohos.permission.SEND_MESSAGES 522 523**System capability**: SystemCapability.Telephony.SmsMms 524 525**Parameters** 526 527| Name | Type | Mandatory| Description | 528| ------- | ------ | ---- | ---------------------------- | 529| content | string | Yes | SMS message content. The value cannot be null.| 530 531**Return value** 532 533| Type | Description | 534| ----------------------- | ----------------------------------- | 535| Promise<Array<string\>> | Promise used to return the result.| 536 537**Error codes** 538 539For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 540 541| ID| Error Message | 542| -------- | -------------------------------------------- | 543| 201 | Permission denied. | 544| 401 | Parameter error. | 545| 8300001 | Invalid parameter value. | 546| 8300002 | Operation failed. Cannot connect to service. | 547| 8300003 | System internal error. | 548| 8300999 | Unknown error code. | 549 550**Example** 551 552```js 553let content = "long message"; 554let promise = sms.splitMessage(content); 555promise.then(data => { 556 console.log(`splitMessage success, promise: data->${JSON.stringify(data)}`); 557}).catch(err => { 558 console.error(`splitMessage failed, promise: err->${JSON.stringify(err)}`); 559}); 560``` 561 562## sms.addSimMessage<sup>7+</sup> 563 564addSimMessage(options: SimMessageOptions, callback: AsyncCallback<void\>): void 565 566Adds a SIM message. This API uses an asynchronous callback to return the result. 567 568**System API**: This is a system API. 569 570**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES 571 572**System capability**: SystemCapability.Telephony.SmsMms 573 574**Parameters** 575 576| Name | Type | Mandatory| Description | 577| -------- | ---------------------------------------- | ---- | --------------- | 578| options | [SimMessageOptions](#simmessageoptions7) | Yes | SIM message options.| 579| callback | AsyncCallback<void> | Yes | Callback used to return the result. | 580 581**Error codes** 582 583For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 584 585| ID| Error Message | 586| -------- | -------------------------------------------- | 587| 201 | Permission denied. | 588| 401 | Parameter error. | 589| 8300001 | Invalid parameter value. | 590| 8300002 | Operation failed. Cannot connect to service. | 591| 8300003 | System internal error. | 592| 8300999 | Unknown error code. | 593 594**Example** 595 596```js 597let simMessageOptions = { 598 slotId: 0, 599 smsc: "test", 600 pdu: "xxxxxx", 601 status: sms.SimMessageStatus.SIM_MESSAGE_STATUS_READ 602}; 603sms.addSimMessage(simMessageOptions, (err) => { 604 console.log(`callback: err->${JSON.stringify(err)}`); 605}); 606``` 607 608 609## sms.addSimMessage<sup>7+</sup> 610 611addSimMessage(options: SimMessageOptions): Promise<void\> 612 613Adds a SIM message. This API uses a promise to return the result. 614 615**System API**: This is a system API. 616 617**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES 618 619**System capability**: SystemCapability.Telephony.SmsMms 620 621**Parameters** 622 623| Name | Type | Mandatory| Description | 624| ------- | ---------------------------------------- | ---- | --------------- | 625| options | [SimMessageOptions](#simmessageoptions7) | Yes | SIM message options.| 626 627**Return value** 628 629| Type | Description | 630| ------------------- | ----------------------------- | 631| Promise<void> | Promise used to return the result.| 632 633**Error codes** 634 635For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 636 637| ID| Error Message | 638| -------- | -------------------------------------------- | 639| 201 | Permission denied. | 640| 401 | Parameter error. | 641| 8300001 | Invalid parameter value. | 642| 8300002 | Operation failed. Cannot connect to service. | 643| 8300003 | System internal error. | 644| 8300999 | Unknown error code. | 645 646**Example** 647 648```js 649let simMessageOptions = { 650 slotId: 0, 651 smsc: "test", 652 pdu: "xxxxxx", 653 status: sms.SimMessageStatus.SIM_MESSAGE_STATUS_READ 654}; 655let promise = sms.addSimMessage(simMessageOptions); 656promise.then(() => { 657 console.log(`addSimMessage success.`); 658}).catch((err) => { 659 console.error(`addSimMessage failed, promise: err->${JSON.stringify(err)}`); 660}); 661``` 662 663## sms.delSimMessage<sup>7+</sup> 664 665delSimMessage(slotId: number, msgIndex: number, callback: AsyncCallback<void\>): void 666 667Deletes a SIM message. This API uses an asynchronous callback to return the result. 668 669**System API**: This is a system API. 670 671**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES 672 673**System capability**: SystemCapability.Telephony.SmsMms 674 675**Parameters** 676 677| Name | Type | Mandatory| Description | 678| -------- | ------------------------- | ---- | ----------------------------------------- | 679| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| 680| msgIndex | number | Yes | Message index. | 681| callback | AsyncCallback<void> | Yes | Callback used to return the result. | 682 683**Error codes** 684 685For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 686 687| ID| Error Message | 688| -------- | -------------------------------------------- | 689| 201 | Permission denied. | 690| 401 | Parameter error. | 691| 8300001 | Invalid parameter value. | 692| 8300002 | Operation failed. Cannot connect to service. | 693| 8300003 | System internal error. | 694| 8300999 | Unknown error code. | 695 696**Example** 697 698```js 699let slotId = 0; 700let msgIndex = 1; 701sms.delSimMessage(slotId, msgIndex, (err) => { 702 console.log(`callback: err->${JSON.stringify(err)}`); 703}); 704``` 705 706 707## sms.delSimMessage<sup>7+</sup> 708 709delSimMessage(slotId: number, msgIndex: number): Promise<void\> 710 711Deletes a SIM message. This API uses a promise to return the result. 712 713**System API**: This is a system API. 714 715**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES 716 717**System capability**: SystemCapability.Telephony.SmsMms 718 719**Parameters** 720 721| Name | Type | Mandatory| Description | 722| -------- | ------ | ---- | ----------------------------------------- | 723| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| 724| msgIndex | number | Yes | Message index. | 725 726**Return value** 727 728| Type | Description | 729| ------------------- | ----------------------------- | 730| Promise<void> | Promise used to return the result.| 731 732**Error codes** 733 734For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 735 736| ID| Error Message | 737| -------- | -------------------------------------------- | 738| 201 | Permission denied. | 739| 401 | Parameter error. | 740| 8300001 | Invalid parameter value. | 741| 8300002 | Operation failed. Cannot connect to service. | 742| 8300003 | System internal error. | 743| 8300999 | Unknown error code. | 744 745**Example** 746 747```js 748let slotId = 0; 749let msgIndex = 1; 750let promise = sms.delSimMessage(slotId, msgIndex); 751promise.then(() => { 752 console.log(`delSimMessage success.`); 753}).catch((err) => { 754 console.error(`delSimMessage failed, promise: err->${JSON.stringify(err)}`); 755}); 756``` 757 758## sms.updateSimMessage<sup>7+</sup> 759 760updateSimMessage(options: UpdateSimMessageOptions, callback: AsyncCallback<void\>): void 761 762Updates a SIM message. This API uses an asynchronous callback to return the result. 763 764**System API**: This is a system API. 765 766**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES 767 768**System capability**: SystemCapability.Telephony.SmsMms 769 770**Parameters** 771 772| Name | Type | Mandatory| Description | 773| -------- | ---------------------------------------------------- | ---- | ------------------- | 774| options | [UpdateSimMessageOptions](#updatesimmessageoptions7) | Yes | SIM message updating options.| 775| callback | AsyncCallback<void> | Yes | Callback used to return the result. | 776 777**Error codes** 778 779For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 780 781| ID| Error Message | 782| -------- | -------------------------------------------- | 783| 201 | Permission denied. | 784| 401 | Parameter error. | 785| 8300001 | Invalid parameter value. | 786| 8300002 | Operation failed. Cannot connect to service. | 787| 8300003 | System internal error. | 788| 8300999 | Unknown error code. | 789 790**Example** 791 792```js 793let updateSimMessageOptions = { 794 slotId: 0, 795 msgIndex: 1, 796 newStatus: sms.SimMessageStatus.SIM_MESSAGE_STATUS_FREE, 797 pdu: "xxxxxxx", 798 smsc: "test" 799}; 800sms.updateSimMessage(updateSimMessageOptions, (err) => { 801 console.log(`callback: err->${JSON.stringify(err)}`); 802}); 803``` 804 805 806## sms.updateSimMessage<sup>7+</sup> 807 808updateSimMessage(options: UpdateSimMessageOptions): Promise<void\> 809 810Updates a SIM message. This API uses a promise to return the result. 811 812**System API**: This is a system API. 813 814**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES 815 816**System capability**: SystemCapability.Telephony.SmsMms 817 818**Parameters** 819 820| Name | Type | Mandatory| Description | 821| ------- | ---------------------------------------------------- | ---- | ------------------- | 822| options | [UpdateSimMessageOptions](#updatesimmessageoptions7) | Yes | SIM message updating options.| 823 824**Return value** 825 826| Type | Description | 827| ------------------- | ----------------------------- | 828| Promise<void> | Promise used to return the result.| 829 830**Error codes** 831 832For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 833 834| ID| Error Message | 835| -------- | -------------------------------------------- | 836| 201 | Permission denied. | 837| 401 | Parameter error. | 838| 8300001 | Invalid parameter value. | 839| 8300002 | Operation failed. Cannot connect to service. | 840| 8300003 | System internal error. | 841| 8300999 | Unknown error code. | 842 843**Example** 844 845```js 846let updateSimMessageOptions = { 847 slotId: 0, 848 msgIndex: 1, 849 newStatus: sms.SimMessageStatus.SIM_MESSAGE_STATUS_FREE, 850 pdu: "xxxxxxx", 851 smsc: "test" 852}; 853let promise = sms.updateSimMessage(updateSimMessageOptions); 854promise.then(() => { 855 console.log(`updateSimMessage success.`); 856}).catch((err) => { 857 console.error(`updateSimMessage failed, promise: err->${JSON.stringify(err)}`); 858}); 859``` 860 861## sms.getAllSimMessages<sup>7+</sup> 862 863getAllSimMessages(slotId: number, callback: AsyncCallback<Array<SimShortMessage\>>): void 864 865Obtains all SIM card messages. This API uses an asynchronous callback to return the result. 866 867**System API**: This is a system API. 868 869**Required permissions**: ohos.permission.RECEIVE_SMS 870 871**System capability**: SystemCapability.Telephony.SmsMms 872 873**Parameters** 874 875| Name | Type | Mandatory| Description | 876| -------- | ----------------------------------------------------------- | ---- | ----------------------------------------- | 877| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| 878| callback | AsyncCallback<Array<[SimShortMessage](#simshortmessage7)\>> | Yes | Callback used to return the result. | 879 880**Error codes** 881 882For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 883 884| ID| Error Message | 885| -------- | -------------------------------------------- | 886| 201 | Permission denied. | 887| 401 | Parameter error. | 888| 8300001 | Invalid parameter value. | 889| 8300002 | Operation failed. Cannot connect to service. | 890| 8300003 | System internal error. | 891| 8300999 | Unknown error code. | 892 893**Example** 894 895```js 896let slotId = 0; 897sms.getAllSimMessages(slotId, (err, data) => { 898 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 899}); 900``` 901 902 903## sms.getAllSimMessages<sup>7+</sup> 904 905getAllSimMessages(slotId: number): Promise<Array<SimShortMessage\>> 906 907Obtains all SIM card messages. This API uses a promise to return the result. 908 909**System API**: This is a system API. 910 911**Required permissions**: ohos.permission.RECEIVE_SMS 912 913**System capability**: SystemCapability.Telephony.SmsMms 914 915**Parameters** 916 917| Name| Type | Mandatory| Description | 918| ------ | ------ | ---- | ----------------------------------------- | 919| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| 920 921**Return value** 922 923| Type | Description | 924| ------------------------------------------------------- | ---------------------------------- | 925| PromiseArray<[SimShortMessage](#simshortmessage7)\>> | Promise used to return the result.| 926 927**Error codes** 928 929For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 930 931| ID| Error Message | 932| -------- | -------------------------------------------- | 933| 201 | Permission denied. | 934| 401 | Parameter error. | 935| 8300001 | Invalid parameter value. | 936| 8300002 | Operation failed. Cannot connect to service. | 937| 8300003 | System internal error. | 938| 8300999 | Unknown error code. | 939 940**Example** 941 942```js 943let slotId = 0; 944let promise = sms.getAllSimMessages(slotId); 945promise.then(data => { 946 console.log(`getAllSimMessages success, promise: data->${JSON.stringify(data)}`); 947}).catch(err => { 948 console.error(`getAllSimMessages failed, promise: err->${JSON.stringify(err)}`); 949}); 950``` 951 952## sms.setCBConfig<sup>7+</sup> 953 954setCBConfig(options: CBConfigOptions, callback: AsyncCallback<void\>): void 955 956Sets the cell broadcast configuration. This API uses an asynchronous callback to return the result. 957 958**System API**: This is a system API. 959 960**Required permissions**: ohos.permission.RECEIVE_SMS 961 962**System capability**: SystemCapability.Telephony.SmsMms 963 964**Parameters** 965 966| Name | Type | Mandatory| Description | 967| -------- | ------------------------------------ | ---- | ------------ | 968| options | [CBConfigOptions](#cbconfigoptions7) | Yes | Cell broadcast configuration options.| 969| callback | AsyncCallback<void> | Yes | Callback used to return the result. | 970 971**Error codes** 972 973For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 974 975| ID| Error Message | 976| -------- | -------------------------------------------- | 977| 201 | Permission denied. | 978| 401 | Parameter error. | 979| 8300001 | Invalid parameter value. | 980| 8300002 | Operation failed. Cannot connect to service. | 981| 8300003 | System internal error. | 982| 8300999 | Unknown error code. | 983 984**Example** 985 986```js 987let cbConfigOptions = { 988 slotId: 0, 989 enable: true, 990 startMessageId: 100, 991 endMessageId: 200, 992 ranType: sms.RanType.TYPE_GSM 993}; 994sms.setCBConfig(cbConfigOptions, (err) => { 995 console.log(`callback: err->${JSON.stringify(err)}`); 996}); 997``` 998 999 1000## sms.setCBConfig<sup>7+</sup> 1001 1002setCBConfig(options: CBConfigOptions): Promise<void\> 1003 1004Sets the cell broadcast configuration. This API uses a promise to return the result. 1005 1006**System API**: This is a system API. 1007 1008**Required permissions**: ohos.permission.RECEIVE_SMS 1009 1010**System capability**: SystemCapability.Telephony.SmsMms 1011 1012**Parameters** 1013 1014| Name | Type | Mandatory| Description | 1015| ------- | ------------------------------------ | ---- | ------------ | 1016| options | [CBConfigOptions](#cbconfigoptions7) | Yes | Cell broadcast configuration options.| 1017 1018**Return value** 1019 1020| Type | Description | 1021| ------------------- | ----------------------------- | 1022| Promise<void> | Promise used to return the result.| 1023 1024**Error codes** 1025 1026For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1027 1028| ID| Error Message | 1029| -------- | -------------------------------------------- | 1030| 201 | Permission denied. | 1031| 401 | Parameter error. | 1032| 8300001 | Invalid parameter value. | 1033| 8300002 | Operation failed. Cannot connect to service. | 1034| 8300003 | System internal error. | 1035| 8300999 | Unknown error code. | 1036 1037**Example** 1038 1039```js 1040let cbConfigOptions = { 1041 slotId: 0, 1042 enable: true, 1043 startMessageId: 100, 1044 endMessageId: 200, 1045 ranType: sms.RanType.TYPE_GSM 1046}; 1047let promise = sms.setCBConfig(cbConfigOptions); 1048promise.then(() => { 1049 console.log(`setCBConfig success.`); 1050}).catch((err) => { 1051 console.error(`setCBConfig failed, promise: err->${JSON.stringify(err)}`); 1052}); 1053``` 1054 1055## sms.getSmsSegmentsInfo<sup>8+</sup> 1056 1057getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean, callback: AsyncCallback<SmsSegmentsInfo\>): void 1058 1059Obtains SMS message segment information. This API uses an asynchronous callback to return the result. 1060 1061**System API**: This is a system API. 1062 1063**System capability**: SystemCapability.Telephony.SmsMms 1064 1065**Parameters** 1066 1067| Name | Type | Mandatory| Description | 1068| --------- | ------------------------------------------------------------ | ---- | ----------------------------------------- | 1069| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| 1070| message | string | Yes | SMS message. | 1071| force7bit | boolean | Yes | Whether to use 7-bit coding. | 1072| callback | AsyncCallback<[SmsSegmentsInfo](#smssegmentsinfo8)> | Yes | Callback used to return the result. | 1073 1074**Error codes** 1075 1076For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1077 1078| ID| Error Message | 1079| -------- | -------------------------------------------- | 1080| 401 | Parameter error. | 1081| 8300001 | Invalid parameter value. | 1082| 8300002 | Operation failed. Cannot connect to service. | 1083| 8300003 | System internal error. | 1084| 8300999 | Unknown error code. | 1085 1086**Example** 1087 1088```js 1089let slotId = 0; 1090sms.getSmsSegmentsInfo(slotId, "message", false, (err, data) => { 1091 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 1092}); 1093``` 1094 1095 1096## sms.getSmsSegmentsInfo<sup>8+</sup> 1097 1098getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean): Promise<SmsSegmentsInfo\> 1099 1100Obtains SMS message segment information. This API uses a promise to return the result. 1101 1102**System API**: This is a system API. 1103 1104**System capability**: SystemCapability.Telephony.SmsMms 1105 1106**Parameters** 1107 1108| Name | Type | Mandatory| Description | 1109| --------- | ------- | ---- | ----------------------------------------- | 1110| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| 1111| message | string | Yes | SMS message. | 1112| force7bit | boolean | Yes | Whether to use 7-bit coding. | 1113 1114**Return value** 1115 1116| Type | Description | 1117| ------------------------------------------------------- | ----------------------------- | 1118| Promise<[SmsSegmentsInfo](#smssegmentsinfo8)> | Promise used to return the result.| 1119 1120**Error codes** 1121 1122For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1123 1124| ID| Error Message | 1125| -------- | -------------------------------------------- | 1126| 401 | Parameter error. | 1127| 8300001 | Invalid parameter value. | 1128| 8300002 | Operation failed. Cannot connect to service. | 1129| 8300003 | System internal error. | 1130| 8300999 | Unknown error code. | 1131 1132**Example** 1133 1134```js 1135let slotId = 0; 1136let promise = sms.getSmsSegmentsInfo(slotId, "message", false); 1137promise.then(data => { 1138 console.log(`getSmsSegmentsInfo success, promise: data->${JSON.stringify(data)}`); 1139}).catch(err => { 1140 console.error(`getSmsSegmentsInfo failed, promise: err->${JSON.stringify(err)}`); 1141}); 1142``` 1143 1144## sms.isImsSmsSupported<sup>8+</sup> 1145 1146isImsSmsSupported(slotId: number, callback: AsyncCallback<boolean\>): void 1147 1148Checks whether SMS is supported on IMS. This API uses an asynchronous callback to return the result. 1149 1150**System API**: This is a system API. 1151 1152**System capability**: SystemCapability.Telephony.SmsMms 1153 1154**Parameters** 1155 1156| Name | Type | Mandatory| Description | 1157| -------- | ---------------------------- | ---- | ---------- | 1158| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| 1159| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.| 1160 1161**Error codes** 1162 1163For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1164 1165| ID| Error Message | 1166| -------- | -------------------------------------------- | 1167| 401 | Parameter error. | 1168| 8300001 | Invalid parameter value. | 1169| 8300002 | Operation failed. Cannot connect to service. | 1170| 8300003 | System internal error. | 1171| 8300999 | Unknown error code. | 1172 1173**Example** 1174 1175```js 1176let slotId = 0; 1177sms.isImsSmsSupported(slotId, (err, data) => { 1178 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 1179}); 1180``` 1181 1182 1183## sms.isImsSmsSupported<sup>8+</sup> 1184 1185isImsSmsSupported(slotId: number): Promise<boolean\> 1186 1187This API uses an asynchronous callback to return the result. This API uses a promise to return the result. 1188 1189**System API**: This is a system API. 1190 1191**System capability**: SystemCapability.Telephony.SmsMms 1192 1193**Parameters** 1194 1195| Name| Type | Mandatory | Description | 1196| ------ | ------ | ---- | -------------------------------------- | 1197| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| 1198 1199**Return value** 1200 1201| Type | Description | 1202| ---------------------- | ----------------------- | 1203| Promise<boolean> | Promise used to return the result.| 1204 1205**Error codes** 1206 1207For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1208 1209| ID| Error Message | 1210| -------- | -------------------------------------------- | 1211| 401 | Parameter error. | 1212| 8300001 | Invalid parameter value. | 1213| 8300002 | Operation failed. Cannot connect to service. | 1214| 8300003 | System internal error. | 1215| 8300999 | Unknown error code. | 1216 1217**Example** 1218 1219```js 1220let slotId = 0; 1221let promise = sms.isImsSmsSupported(slotId); 1222promise.then(data => { 1223 console.log(`isImsSmsSupported success, promise: data->${JSON.stringify(data)}`); 1224}).catch(err => { 1225 console.error(`isImsSmsSupported failed, promise: err->${JSON.stringify(err)}`); 1226}); 1227``` 1228 1229## sms.getImsShortMessageFormat<sup>8+</sup> 1230 1231getImsShortMessageFormat(callback: AsyncCallback<string\>): void 1232 1233Obtains the SMS format supported by the IMS. This API uses an asynchronous callback to return the result. 1234 1235**System API**: This is a system API. 1236 1237**System capability**: SystemCapability.Telephony.SmsMms 1238 1239**Parameters** 1240 1241| Name | Type | Mandatory| Description | 1242| -------- | --------------------------- | ---- | ---------- | 1243| callback | AsyncCallback<string> | Yes | Callback used to return the result.| 1244 1245**Error codes** 1246 1247For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1248 1249| ID| Error Message | 1250| -------- | -------------------------------------------- | 1251| 401 | Parameter error. | 1252| 8300001 | Invalid parameter value. | 1253| 8300002 | Operation failed. Cannot connect to service. | 1254| 8300003 | System internal error. | 1255| 8300999 | Unknown error code. | 1256 1257**Example** 1258 1259```js 1260sms.getImsShortMessageFormat((err, data) => { 1261 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 1262}); 1263``` 1264 1265 1266## sms.getImsShortMessageFormat<sup>8+</sup> 1267 1268getImsShortMessageFormat(): Promise<string\> 1269 1270Obtains the SMS format supported by the IMS. This API uses a promise to return the result. 1271 1272**System API**: This is a system API. 1273 1274**System capability**: SystemCapability.Telephony.SmsMms 1275 1276**Return value** 1277 1278| Type | Description | 1279| --------------------- | -------------------------- | 1280| Promise<string> | Promise used to return the result. | 1281 1282**Error codes** 1283 1284For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1285 1286| ID| Error Message | 1287| -------- | -------------------------------------------- | 1288| 401 | Parameter error. | 1289| 8300001 | Invalid parameter value. | 1290| 8300002 | Operation failed. Cannot connect to service. | 1291| 8300003 | System internal error. | 1292| 8300999 | Unknown error code. | 1293 1294**Example** 1295 1296```js 1297let promise = sms.getImsShortMessageFormat(); 1298promise.then(data => { 1299 console.log(`getImsShortMessageFormat success, promise: data->${JSON.stringify(data)}`); 1300}).catch(err => { 1301 console.error(`getImsShortMessageFormat failed, promise: err->${JSON.stringify(err)}`); 1302}); 1303``` 1304 1305## sms.decodeMms<sup>8+</sup> 1306 1307decodeMms(mmsFilePathName: string | Array<number\>, callback: AsyncCallback<MmsInformation\>): void 1308 1309Decodes MMS messages. This API uses an asynchronous callback to return the result. 1310 1311**System API**: This is a system API. 1312 1313**System capability**: SystemCapability.Telephony.SmsMms 1314 1315**Parameters** 1316 1317| Name | Type | Mandatory| Description | 1318| --------------- | ------------------------------------------------------- | ---- | -------------- | 1319| mmsFilePathName | string \|Array<number\> | Yes | MMS message file path.| 1320| callback | AsyncCallback<[MmsInformation](#mmsinformation8)> | Yes | Callback used to return the result. | 1321 1322**Error codes** 1323 1324For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1325 1326| ID| Error Message | 1327| -------- | -------------------------------------------- | 1328| 401 | Parameter error. | 1329| 8300001 | Invalid parameter value. | 1330| 8300002 | Operation failed. Cannot connect to service. | 1331| 8300003 | System internal error. | 1332| 8300999 | Unknown error code. | 1333 1334**Example** 1335 1336```js 1337let mmsFilePathName = "filename"; 1338sms.decodeMms(mmsFilePathName, (err, data) => { 1339 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 1340}); 1341``` 1342 1343 1344## sms.decodeMms<sup>8+</sup> 1345 1346decodeMms(mmsFilePathName: string | Array<number\>): Promise<MmsInformation\> 1347 1348Decodes MMS messages. This API uses a promise to return the result. 1349 1350**System API**: This is a system API. 1351 1352**System capability**: SystemCapability.Telephony.SmsMms 1353 1354**Parameters** 1355 1356| Name | Type | Mandatory| Description | 1357| --------------- | ----------------------- | ---- | -------------- | 1358| mmsFilePathName | string \|Array<number\> | Yes | MMS message file path.| 1359 1360**Return value** 1361 1362| Type | Description | 1363| --------------------------------------------------------- | --------------------------- | 1364| Promise<<[MmsInformation](#mmsinformation8)>> | Promise used to return the result.| 1365 1366**Error codes** 1367 1368For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1369 1370| ID| Error Message | 1371| -------- | -------------------------------------------- | 1372| 401 | Parameter error. | 1373| 8300001 | Invalid parameter value. | 1374| 8300002 | Operation failed. Cannot connect to service. | 1375| 8300003 | System internal error. | 1376| 8300999 | Unknown error code. | 1377 1378**Example** 1379 1380```js 1381let mmsFilePathName = "filename"; 1382let promise = sms.decodeMms(mmsFilePathName); 1383promise.then(data => { 1384 console.log(`decodeMms success, promise: data->${JSON.stringify(data)}`); 1385}).catch(err => { 1386 console.error(`decodeMms failed, promise: err->${JSON.stringify(err)}`); 1387}); 1388``` 1389 1390## sms.encodeMms<sup>8+</sup> 1391 1392encodeMms(mms: MmsInformation, callback: AsyncCallback<Array<number\>>): void 1393 1394MMS message code. This API uses an asynchronous callback to return the result. 1395 1396**System API**: This is a system API. 1397 1398**System capability**: SystemCapability.Telephony.SmsMms 1399 1400**Parameters** 1401 1402| Name | Type | Mandatory| Description | 1403| -------- | ----------------------------------- | ---- | ---------- | 1404| mms | [MmsInformation](#mmsinformation8) | Yes | MMS message information.| 1405| callback | AsyncCallback<Array<number\>> | Yes | Callback used to return the result.| 1406 1407**Error codes** 1408 1409For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1410 1411| ID| Error Message | 1412| -------- | -------------------------------------------- | 1413| 401 | Parameter error. | 1414| 8300001 | Invalid parameter value. | 1415| 8300002 | Operation failed. Cannot connect to service. | 1416| 8300003 | System internal error. | 1417| 8300999 | Unknown error code. | 1418 1419**Example** 1420 1421```js 1422let mmsAcknowledgeInd = { 1423 transactionId: "100", 1424 version: sms.MmsVersionType.MMS_VERSION_1_0, 1425 reportAllowed: sms.ReportType.MMS_YES 1426}; 1427let mmsInformation = { 1428 messageType: sms.MessageType.TYPE_MMS_ACKNOWLEDGE_IND, 1429 mmsType: mmsAcknowledgeInd 1430}; 1431sms.encodeMms(mmsInformation, (err, data) => { 1432 console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 1433}); 1434``` 1435 1436 1437## sms.encodeMms<sup>8+</sup> 1438 1439encodeMms(mms: MmsInformation): Promise<Array<number\>> 1440 1441MMS message code. This API uses a promise to return the result. 1442 1443**System API**: This is a system API. 1444 1445**System capability**: SystemCapability.Telephony.SmsMms 1446 1447**Parameters** 1448 1449| Name| Type | Mandatory| Description | 1450| ------ | ---------------------------------- | ---- | ---------- | 1451| mms | [MmsInformation](#mmsinformation8) | Yes | MMS message information.| 1452 1453**Return value** 1454 1455| Type | Description | 1456| ----------------------------- | ----------------------------------- | 1457| Promise<Array<number\>> | Promise used to return the result.| 1458 1459**Error codes** 1460 1461For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). 1462 1463| ID| Error Message | 1464| -------- | -------------------------------------------- | 1465| 401 | Parameter error. | 1466| 8300001 | Invalid parameter value. | 1467| 8300002 | Operation failed. Cannot connect to service. | 1468| 8300003 | System internal error. | 1469| 8300999 | Unknown error code. | 1470 1471**Example** 1472 1473```js 1474let mmsAcknowledgeInd = { 1475 transactionId: "100", 1476 version: sms.MmsVersionType.MMS_VERSION_1_0, 1477 reportAllowed: sms.ReportType.MMS_YES 1478}; 1479let mmsInformation = { 1480 messageType: sms.MessageType.TYPE_MMS_ACKNOWLEDGE_IND, 1481 mmsType: mmsAcknowledgeInd 1482}; 1483let promise = sms.encodeMms(mmsInformation); 1484promise.then(data => { 1485 console.log(`encodeMms success, promise: data->${JSON.stringify(data)}`); 1486}).catch(err => { 1487 console.error(`encodeMms failed, promise: err->${JSON.stringify(err)}`); 1488}); 1489``` 1490 1491## ShortMessage 1492 1493Defines an SMS message instance. 1494 1495**System capability**: SystemCapability.Telephony.SmsMms 1496 1497| Name | Type | Mandatory| Description | 1498| ------------------------ | --------------------------------------- | ---- | ------------------------------------------------------------ | 1499| hasReplyPath | boolean | Yes | Whether the received SMS contains **TP-Reply-Path**. The default value is **false**.<br>TP-Reply-Path: The device returns a response based on the SMSC that sends the SMS message. | 1500| isReplaceMessage | boolean | Yes | Whether the received SMS message is a **replace short message**. The default value is **false**.<br>For details, see section 9.2.3.9 in **3GPP TS 23.040**.| 1501| isSmsStatusReportMessage | boolean | Yes | Whether the received SMS message is an SMS delivery report. The default value is **false**.<br>SMS delivery report: a message sent from the SMSC to show the current status of the SMS message you delivered.| 1502| messageClass | [ShortMessageClass](#shortmessageclass) | Yes | Enumerates SMS message types. | 1503| pdu | Array<number> | Yes | PDU in the SMS message. | 1504| protocolId | number | Yes | Protocol identifier used for delivering the SMS message. | 1505| scAddress | string | Yes | SMSC address. | 1506| scTimestamp | number | Yes | SMSC timestamp. | 1507| status | number | Yes | SMS message status sent by the SMSC in the **SMS-STATUS-REPORT** message.| 1508| visibleMessageBody | string | Yes | SMS message body. | 1509| visibleRawAddress | string | Yes | Sender address. | 1510 1511 1512## ShortMessageClass 1513 1514Enumerates SMS message types. 1515 1516**System capability**: SystemCapability.Telephony.SmsMms 1517 1518| Name | Value | Description | 1519| ---------------- | ---- | ---------------------------------------- | 1520| UNKNOWN | 0 | Unknown type. | 1521| INSTANT_MESSAGE | 1 | Instant message, which is displayed immediately after being received. | 1522| OPTIONAL_MESSAGE | 2 | Message stored in the device or SIM card. | 1523| SIM_MESSAGE | 3 | Message containing SIM card information, which is to be stored in the SIM card.| 1524| FORWARD_MESSAGE | 4 | Message to be forwarded to another device. | 1525 1526 1527## SendMessageOptions 1528 1529Provides the options (including callbacks) for sending an SMS message. For example, you can specify the SMS message type by the optional parameter **content**. 1530 1531**System capability**: SystemCapability.Telephony.SmsMms 1532 1533| Name | Type | Mandatory| Description | 1534| ---------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 1535| slotId | number | Yes | Slot ID of the SIM card used for sending SMS messages. <br>- **0**: card slot 1<br>- **1**: card slot 2 | 1536| destinationHost | string | Yes | Destination address of the SMS message. | 1537| content | string \| Array<number> | Yes | SMS message type. If the content is composed of character strings, the SMS message is a text message. If the content is composed of byte arrays, the SMS message is a data message.| 1538| serviceCenter | string | No | SMSC address. By default, the SMSC address in the SIM card is used. | 1539| destinationPort | number | No | Destination port of the SMS message. This field is mandatory only for a data message. Otherwise, it is optional. | 1540| sendCallback | AsyncCallback<[ISendShortMessageCallback](#isendshortmessagecallback)> | No | Callback used to return the SMS message sending result. For details, see [ISendShortMessageCallback](#isendshortmessagecallback).| 1541| deliveryCallback | AsyncCallback<[IDeliveryShortMessageCallback](#ideliveryshortmessagecallback)> | No | Callback used to return the SMS message delivery report. For details, see [IDeliveryShortMessageCallback](#ideliveryshortmessagecallback).| 1542 1543 1544## ISendShortMessageCallback 1545 1546Provides the callback for the SMS message sending result. It consists of three parts: SMS message sending result, URI for storing the sent SMS message, and whether the SMS message is the last part of a long SMS message. 1547 1548**System capability**: SystemCapability.Telephony.SmsMms 1549 1550| Name | Type | Mandatory| Description | 1551| ---------- | ------------------------------- | ---- | ----------------------------------------------------------------------------------------- | 1552| isLastPart | boolean | No | Whether this SMS message is the last part of a long SMS message. The value **true** indicates that this SMS message is the last part of a long SMS message, and value **false** indicates the opposite. The default value is **false**.| 1553| result | [SendSmsResult](#sendsmsresult) | Yes | SMS message sending result. | 1554| url | string | Yes | URI for storing the sent SMS message. | 1555 1556 1557## IDeliveryShortMessageCallback 1558 1559Provides the callback for the SMS message delivery report. 1560 1561**System capability**: SystemCapability.Telephony.SmsMms 1562 1563| Name| Type | Mandatory| Description | 1564| ---- | ------------------- | ---- | -------------- | 1565| pdu | Array<number> | Yes | SMS message delivery report.| 1566 1567 1568## SendSmsResult 1569 1570Enumerates SMS message sending results. 1571 1572**System capability**: SystemCapability.Telephony.SmsMms 1573 1574| Name | Value | Description | 1575| ------------------------------------ | ---- | ------------------------------------------------------ | 1576| SEND_SMS_SUCCESS | 0 | The SMS message is sent successfully. | 1577| SEND_SMS_FAILURE_UNKNOWN | 1 | Failed to send the SMS message due to an unknown reason. | 1578| SEND_SMS_FAILURE_RADIO_OFF | 2 | Failed to send the SMS message because the modem is shut down. | 1579| SEND_SMS_FAILURE_SERVICE_UNAVAILABLE | 3 | Failed to send the SMS message because the network is unavailable or SMS message sending or receiving is not supported.| 1580 1581## MmsInformation<sup>8+</sup> 1582 1583Defines the MMS message information. 1584 1585**System API**: This is a system API. 1586 1587**System capability**: SystemCapability.Telephony.SmsMms 1588 1589| Name | Type | Mandatory| Description | 1590| ----------- | ------------------------------------------------------------ | ---- | ---------- | 1591| messageType | [MessageType](#messagetype8) | Yes | Message type.| 1592| mmsType | [MmsSendReq](#mmssendreq8) \|[MmsSendConf](#mmssendconf8) \|[MmsNotificationInd](#mmsnotificationind8) \|[MmsRespInd](#mmsrespind8) \|[MmsRetrieveConf](#mmsretrieveconf8)\|[MmsAcknowledgeInd](#mmsacknowledgeind8)\|[MmsDeliveryInd](#mmsdeliveryind8)\|[MmsReadOrigInd](#mmsreadorigind8)\|[MmsReadRecInd](#mmsreadrecind8) | Yes | PDU header type.| 1593| attachment | Array<[MmsAttachment](#mmsattachment8)\> | No | Attachment. | 1594 1595## MmsSendReq<sup>8+</sup> 1596 1597Defines an MMS message sending request. 1598 1599**System API**: This is a system API. 1600 1601**System capability**: SystemCapability.Telephony.SmsMms 1602 1603| Name | Type | Mandatory| Description | 1604| ---------------- | ------------------------------------ | ---- | ------------ | 1605| from | [MmsAddress](#mmsaddress8) | Yes | MMS message source. | 1606| transactionId | string | Yes | Transaction ID. | 1607| contentType | string | Yes | Content type. | 1608| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | 1609| to | Array<[MmsAddress](#mmsaddress8)\> | No | Destination address. | 1610| date | number | No | Date. | 1611| cc | Array<[MmsAddress](#mmsaddress8)\> | No | Carbon copy. | 1612| bcc | Array<[MmsAddress](#mmsaddress8)\> | No | Blind carbon copy. | 1613| subject | string | No | Subject. | 1614| messageClass | number | No | Message class. | 1615| expiry | number | No | Expiration. | 1616| priority | [MmsPriorityType](#mmsprioritytype8) | No | Priority. | 1617| senderVisibility | number | No | Sender visibility.| 1618| deliveryReport | number | No | Delivery report. | 1619| readReport | number | No | Read report. | 1620 1621## MmsSendConf<sup>8+</sup> 1622 1623Defines the MMS message sending configuration. 1624 1625**System API**: This is a system API. 1626 1627**System capability**: SystemCapability.Telephony.SmsMms 1628 1629| Name | Type | Mandatory| Description | 1630| ------------- | ---------------------------------- | ---- | -------- | 1631| responseState | number | Yes | Response status.| 1632| transactionId | string | Yes | Transaction ID. | 1633| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | 1634| messageId | string | No | Message ID. | 1635 1636## MmsNotificationInd<sup>8+</sup> 1637 1638Defines an MMS notification index. 1639 1640**System API**: This is a system API. 1641 1642**System capability**: SystemCapability.Telephony.SmsMms 1643 1644| Name | Type | Mandatory| Description | 1645| --------------- | ---------------------------------- | ---- | -------- | 1646| transactionId | string | Yes | Transaction ID. | 1647| messageClass | number | Yes | Message class. | 1648| messageSize | number | Yes | Message size.| 1649| expiry | number | Yes | Expiration. | 1650| contentLocation | string | Yes | Content location.| 1651| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | 1652| from | [MmsAddress](#mmsaddress8) | No | Source address. | 1653| subject | string | No | Subject. | 1654| deliveryReport | number | No | Status report.| 1655| contentClass | number | No | Content class. | 1656 1657## MmsAcknowledgeInd<sup>8+</sup> 1658 1659Defines an MMS confirmation index. 1660 1661**System API**: This is a system API. 1662 1663**System capability**: SystemCapability.Telephony.SmsMms 1664 1665| Name | Type | Mandatory| Description | 1666| ------------- | ---------------------------------- | ---- | -------- | 1667| transactionId | string | Yes | Transaction ID. | 1668| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | 1669| reportAllowed | [ReportType](#reporttype8) | No | Report allowed.| 1670 1671## MmsRetrieveConf<sup>8+</sup> 1672 1673Defines the MMS message retrieval configuration. 1674 1675**System API**: This is a system API. 1676 1677**System capability**: SystemCapability.Telephony.SmsMms 1678 1679| Name | Type | Mandatory| Description | 1680| -------------- | ------------------------------------ | ---- | -------- | 1681| transactionId | string | Yes | Transaction ID. | 1682| messageId | string | Yes | Message ID. | 1683| date | number | Yes | Date. | 1684| contentType | string | Yes | Content type.| 1685| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address. | 1686| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | 1687| from | [MmsAddress](#mmsaddress8) | No | Source address. | 1688| cc | Array<[MmsAddress](#mmsaddress8)\> | No | Carbon copy. | 1689| subject | string | No | Subject. | 1690| priority | [MmsPriorityType](#mmsprioritytype8) | No | Priority. | 1691| deliveryReport | number | No | Status report.| 1692| readReport | number | No | Read report.| 1693| retrieveStatus | number | No | Retrieval status.| 1694| retrieveText | string | No | Retrieval text.| 1695 1696## MmsReadOrigInd<sup>8+</sup> 1697 1698Defines the original MMS message reading index. 1699 1700**System API**: This is a system API. 1701 1702**System capability**: SystemCapability.Telephony.SmsMms 1703 1704| Name | Type | Mandatory| Description | 1705| ---------- | ---------------------------------- | ---- | -------- | 1706| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | 1707| messageId | string | Yes | Message ID. | 1708| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address. | 1709| from | [MmsAddress](#mmsaddress8) | Yes | Source address. | 1710| date | number | Yes | Date. | 1711| readStatus | number | Yes | Read status.| 1712 1713## MmsReadRecInd<sup>8+</sup> 1714 1715Defines the MMS message reading index. 1716 1717**System API**: This is a system API. 1718 1719**System capability**: SystemCapability.Telephony.SmsMms 1720 1721| Name | Type | Mandatory| Description | 1722| ---------- | ---------------------------------- | ---- | -------- | 1723| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | 1724| messageId | string | Yes | Message ID. | 1725| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address. | 1726| from | [MmsAddress](#mmsaddress8) | Yes | Source address. | 1727| readStatus | number | Yes | Read status.| 1728| date | number | No | Date. | 1729 1730## MmsAttachment<sup>8+</sup> 1731 1732Defines the attachment of an MMS message. 1733 1734**System API**: This is a system API. 1735 1736**System capability**: SystemCapability.Telephony.SmsMms 1737 1738| Name | Type | Mandatory| Description | 1739| ----------------------- | ------------------------------------ | ---- | ------------------ | 1740| contentId | string | Yes | Content ID. | 1741| contentLocation | string | Yes | Content location. | 1742| contentDisposition | [DispositionType](#dispositiontype8) | Yes | Content disposition. | 1743| contentTransferEncoding | string | Yes | Encoding for content transfer. | 1744| contentType | string | Yes | Content type. | 1745| isSmil | boolean | Yes | Whether the synchronized multimedia integration language is used.| 1746| path | string | No | Path. | 1747| inBuff | Array<number\> | No | Whether the message is in the buffer. | 1748| fileName | string | No | File name. | 1749| charset | [MmsCharSets](#mmscharsets8) | No | Character set. | 1750 1751## MmsAddress<sup>8+</sup> 1752 1753Defines an MMSC address. 1754 1755**System API**: This is a system API. 1756 1757**System capability**: SystemCapability.Telephony.SmsMms 1758 1759| Name | Type | Mandatory| Description | 1760| ------- | ---------------------------- | ---- | ------ | 1761| address | string | Yes | Network address. | 1762| charset | [MmsCharSets](#mmscharsets8) | Yes | Character set.| 1763 1764## MessageType<sup>8+</sup> 1765 1766Message type. 1767 1768**System API**: This is a system API. 1769 1770**System capability**: SystemCapability.Telephony.SmsMms 1771 1772| Name | Value | Description | 1773| ------------------------- | ---- | -------------------- | 1774| TYPE_MMS_SEND_REQ | 128 | MMS message sending request. | 1775| TYPE_MMS_SEND_CONF | 129 | MMS message sending configuration. | 1776| TYPE_MMS_NOTIFICATION_IND | 130 | MMS notification index. | 1777| TYPE_MMS_RESP_IND | 131 | MMS message response index. | 1778| TYPE_MMS_RETRIEVE_CONF | 132 | MMS message retrieval configuration. | 1779| TYPE_MMS_ACKNOWLEDGE_IND | 133 | MMS message acknowledgement index. | 1780| TYPE_MMS_DELIVERY_IND | 134 | MMS message delivery index. | 1781| TYPE_MMS_READ_REC_IND | 135 | MMS message reading and receiving index.| 1782| TYPE_MMS_READ_ORIG_IND | 136 | Original MMS message reading index.| 1783 1784## MmsPriorityType<sup>8+</sup> 1785 1786Enumerates MMS message priorities. 1787 1788**System API**: This is a system API. 1789 1790**System capability**: SystemCapability.Telephony.SmsMms 1791 1792| Name | Value | Description | 1793| ---------- | ---- | -------------- | 1794| MMS_LOW | 128 | Low priority. | 1795| MMS_NORMAL | 129 | Normal priority.| 1796| MMS_HIGH | 130 | High priority. | 1797 1798## MmsVersionType<sup>8+</sup> 1799 1800Enumerates MMS versions. 1801 1802**System API**: This is a system API. 1803 1804**System capability**: SystemCapability.Telephony.SmsMms 1805 1806| Name | Value | Description | 1807| --------------- | ---- | ----------- | 1808| MMS_VERSION_1_0 | 0x10 | MMS version 1_0.| 1809| MMS_VERSION_1_1 | 0x11 | MMS version 1_1.| 1810| MMS_VERSION_1_2 | 0x12 | MMS version 1_2.| 1811| MMS_VERSION_1_3 | 0x13 | MMS version 1_3.| 1812 1813## MmsCharSets<sup>8+</sup> 1814 1815Enumerates MMS character sets. 1816 1817**System API**: This is a system API. 1818 1819**System capability**: SystemCapability.Telephony.SmsMms 1820 1821| Name | Value | Description | 1822| --------------- | ------ | ------------------- | 1823| BIG5 | 0X07EA | BIG5 format. | 1824| ISO_10646_UCS_2 | 0X03E8 | ISO_10646_UCS_2 format.| 1825| ISO_8859_1 | 0X04 | ISO_8859_1 format. | 1826| ISO_8859_2 | 0X05 | ISO_8859_2 format. | 1827| ISO_8859_3 | 0X06 | ISO_8859_3 format. | 1828| ISO_8859_4 | 0X07 | ISO_8859_4 format. | 1829| ISO_8859_5 | 0X08 | ISO_8859_5 format. | 1830| ISO_8859_6 | 0X09 | ISO_8859_6 format. | 1831| ISO_8859_7 | 0X0A | ISO_8859_7 format. | 1832| ISO_8859_8 | 0X0B | ISO_8859_8 format. | 1833| ISO_8859_9 | 0X0C | ISO_8859_9 format. | 1834| SHIFT_JIS | 0X11 | SHIFT_JIS format. | 1835| US_ASCII | 0X03 | US_ASCII format. | 1836| UTF_8 | 0X6A | UTF_8 format. | 1837 1838## DispositionType<sup>8+</sup> 1839 1840Enumerates disposition types. 1841 1842**System API**: This is a system API. 1843 1844**System capability**: SystemCapability.Telephony.SmsMms 1845 1846| Name | Value | Description | 1847| ---------- | ---- | -------- | 1848| FROM_DATA | 0 | Data source.| 1849| ATTACHMENT | 1 | Attachment. | 1850| INLINE | 2 | Inlining. | 1851 1852## ReportType<sup>8+</sup> 1853 1854Enumerates report types. 1855 1856**System API**: This is a system API. 1857 1858**System capability**: SystemCapability.Telephony.SmsMms 1859 1860| Name | Value | Description| 1861| ------- | ---- | ---- | 1862| MMS_YES | 128 | YES | 1863| MMS_NO | 129 | NO | 1864 1865## CBConfigOptions<sup>7+</sup> 1866 1867Defines the cell broadcast configuration options. 1868 1869**System API**: This is a system API. 1870 1871**System capability**: SystemCapability.Telephony.SmsMms 1872 1873| Name | Type | Mandatory| Description | 1874| -------------- | -------------------- | ---- | ------------ | 1875| slotId | number | Yes | Card slot ID. | 1876| enable | boolean | Yes | Whether to enable cell broadcast. | 1877| startMessageId | number | Yes | Start message ID. | 1878| endMessageId | number | Yes | End message ID. | 1879| ranType | [RanType](#rantype7) | Yes | RAN type.| 1880 1881## SimMessageStatus<sup>7+</sup> 1882 1883Defines the SIM message status. 1884 1885**System API**: This is a system API. 1886 1887**System capability**: SystemCapability.Telephony.SmsMms 1888 1889| Name | Value | Description | 1890| ------------------------- | ---- | --------------------------- | 1891| SIM_MESSAGE_STATUS_FREE | 0 | Free state. | 1892| SIM_MESSAGE_STATUS_READ | 1 | Read state. | 1893| SIM_MESSAGE_STATUS_UNREAD | 3 | Unread state. | 1894| SIM_MESSAGE_STATUS_SENT | 5 | Storage of sent messages (applicable only to SMS).| 1895| SIM_MESSAGE_STATUS_UNSENT | 7 | Storage of unsent messages (applicable only to SMS).| 1896 1897## RanType<sup>7+</sup> 1898 1899RAN type. 1900 1901**System API**: This is a system API. 1902 1903**System capability**: SystemCapability.Telephony.SmsMms 1904 1905| Name | Value | Description| 1906| --------- | ---- | ---- | 1907| TYPE_GSM | 1 | GSM | 1908| TYPE_CDMA | 2 | CMDA | 1909 1910## SmsEncodingScheme<sup>8+</sup> 1911 1912Enumerates SMS encoding schemes. 1913 1914**System API**: This is a system API. 1915 1916**System capability**: SystemCapability.Telephony.SmsMms 1917 1918| Name | Value | Description | 1919| -------------------- | ---- | ------------ | 1920| SMS_ENCODING_UNKNOWN | 0 | Unknown code.| 1921| SMS_ENCODING_7BIT | 1 | 7-digit code. | 1922| SMS_ENCODING_8BIT | 2 | 8-digit code. | 1923| SMS_ENCODING_16BIT | 3 | 16-digit code.| 1924 1925## SimMessageOptions<sup>7+</sup> 1926 1927Defines the SIM message options. 1928 1929**System API**: This is a system API. 1930 1931**System capability**: SystemCapability.Telephony.SmsMms 1932 1933| Name | Type | Mandatory| Description | 1934| ------ | -------------------------------------- | ---- | -------------- | 1935| slotId | number | Yes | Card slot ID. | 1936| smsc | string | Yes | Short message service center.| 1937| pdu | string | Yes | Protocol data unit. | 1938| status | [SimMessageStatus](#simmessagestatus7) | Yes | Status. | 1939 1940## UpdateSimMessageOptions<sup>7+</sup> 1941 1942Defines the updating SIM message options. 1943 1944**System API**: This is a system API. 1945 1946**System capability**: SystemCapability.Telephony.SmsMms 1947 1948| Name | Type | Mandatory| Description | 1949| --------- | -------------------------------------- | ---- | -------------- | 1950| slotId | number | Yes | Card slot ID. | 1951| msgIndex | number | Yes | Message index. | 1952| newStatus | [SimMessageStatus](#simmessagestatus7) | Yes | New status. | 1953| pdu | string | Yes | Protocol data unit. | 1954| smsc | string | Yes | Short message service center.| 1955 1956## SimShortMessage<sup>7+</sup> 1957 1958Defines a SIM message. 1959 1960**System API**: This is a system API. 1961 1962**System capability**: SystemCapability.Telephony.SmsMms 1963 1964| Name | Type | Mandatory| Description | 1965| ---------------- | -------------------------------------- | ---- | ------------- | 1966| shortMessage | [ShortMessage](#shortmessage) | Yes | SMS message. | 1967| simMessageStatus | [SimMessageStatus](#simmessagestatus7) | Yes | SIM message status.| 1968| indexOnSim | number | Yes | SIM card index. | 1969 1970## MmsDeliveryInd<sup>8+</sup> 1971 1972Defines an MMS message delivery index. 1973 1974**System API**: This is a system API. 1975 1976**System capability**: SystemCapability.Telephony.SmsMms 1977 1978| Name | Type | Mandatory| Description | 1979| --------- | ---------------------------------- | ---- | ------ | 1980| messageId | string | Yes | Message ID.| 1981| date | number | Yes | Date. | 1982| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address.| 1983| status | number | Yes | Status | 1984| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | 1985 1986## MmsRespInd<sup>8+</sup> 1987 1988Defines an MMS response index. 1989 1990**System API**: This is a system API. 1991 1992**System capability**: SystemCapability.Telephony.SmsMms 1993 1994| Name | Type | Mandatory| Description | 1995| ------------- | ---------------------------------- | ---- | -------- | 1996| transactionId | string | Yes | Event ID. | 1997| status | number | Yes | Status | 1998| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | 1999| reportAllowed | [ReportType](#reporttype8) | No | Report allowed.| 2000 2001## SmsSegmentsInfo<sup>8+</sup> 2002 2003Defines the SMS message segment information. 2004 2005**System API**: This is a system API. 2006 2007**System capability**: SystemCapability.Telephony.SmsMms 2008 2009| Name | Type | Mandatory| Description | 2010| -------------------- | ---------------------------------------- | ---- | ------------ | 2011| splitCount | number | Yes | Split count. | 2012| encodeCount | number | Yes | Encoding count. | 2013| encodeCountRemaining | number | Yes | Remaining encoding count.| 2014| scheme | [SmsEncodingScheme](#smsencodingscheme8) | Yes | Encoding scheme.| 2015