1e41f4b71Sopenharmony_ci# Telephony Subsystem Changelog 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci## cl.telephony.1 SMS Module API Change 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ciDeprecated **sendMessage** and replaced it with **sendShortMessage**. 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci**Change Impact** 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci**sendMessage** is deprecated since API version 10. **sendShortMessage** should be used to replace **sendMessage** in application development. The API function remains unchanged. 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci**Key API/Component Changes** 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ciAPI before change: 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci```js 18e41f4b71Sopenharmony_cifunction sendMessage(options: SendMessageOptions): void; 19e41f4b71Sopenharmony_ci``` 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ciAPI after change: 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ci```js 24e41f4b71Sopenharmony_cifunction sendShortMessage(options: SendMessageOptions, callback: AsyncCallback<void>): void; 25e41f4b71Sopenharmony_cifunction sendShortMessage(options: SendMessageOptions): Promise<void>; 26e41f4b71Sopenharmony_ci``` 27e41f4b71Sopenharmony_ci 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci 30e41f4b71Sopenharmony_ci**Adaptation Guide** 31e41f4b71Sopenharmony_ci 32e41f4b71Sopenharmony_ciUse the new API. The sample code is as follows: 33e41f4b71Sopenharmony_ci 34e41f4b71Sopenharmony_ci```js 35e41f4b71Sopenharmony_ciimport sms from '@ohos.telephony.sms'; 36e41f4b71Sopenharmony_ci 37e41f4b71Sopenharmony_cilet sendCallback = function (err, data) { 38e41f4b71Sopenharmony_ci console.log(`sendCallback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 39e41f4b71Sopenharmony_ci} 40e41f4b71Sopenharmony_cilet deliveryCallback = function (err, data) { 41e41f4b71Sopenharmony_ci console.log(`deliveryCallback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 42e41f4b71Sopenharmony_ci} 43e41f4b71Sopenharmony_cilet slotId = 0; 44e41f4b71Sopenharmony_cilet content ='SMS message content'; 45e41f4b71Sopenharmony_cilet destinationHost = '+861xxxxxxxxxx'; 46e41f4b71Sopenharmony_cilet serviceCenter = '+861xxxxxxxxxx'; 47e41f4b71Sopenharmony_cilet destinationPort = 1000; 48e41f4b71Sopenharmony_cilet options = {slotId, content, destinationHost, serviceCenter, destinationPort, sendCallback, deliveryCallback}; 49e41f4b71Sopenharmony_cisms.sendShortMessage(options, (err) => { 50e41f4b71Sopenharmony_ci console.log(`callback: err->${JSON.stringify(err)}`); 51e41f4b71Sopenharmony_ci}); 52e41f4b71Sopenharmony_ci``` 53e41f4b71Sopenharmony_ci 54e41f4b71Sopenharmony_ci```js 55e41f4b71Sopenharmony_ciimport sms from '@ohos.telephony.sms'; 56e41f4b71Sopenharmony_ci 57e41f4b71Sopenharmony_cilet sendCallback = function (err, data) { 58e41f4b71Sopenharmony_ci console.log(`sendCallback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 59e41f4b71Sopenharmony_ci} 60e41f4b71Sopenharmony_cilet deliveryCallback = function (err, data) { 61e41f4b71Sopenharmony_ci console.log(`deliveryCallback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 62e41f4b71Sopenharmony_ci} 63e41f4b71Sopenharmony_cilet slotId = 0; 64e41f4b71Sopenharmony_cilet content ='SMS message content'; 65e41f4b71Sopenharmony_cilet destinationHost = '+861xxxxxxxxxx'; 66e41f4b71Sopenharmony_cilet serviceCenter = '+861xxxxxxxxxx'; 67e41f4b71Sopenharmony_cilet destinationPort = 1000; 68e41f4b71Sopenharmony_cilet options = {slotId, content, destinationHost, serviceCenter, destinationPort, sendCallback, deliveryCallback}; 69e41f4b71Sopenharmony_cilet promise = sms.sendShortMessage(options); 70e41f4b71Sopenharmony_cipromise.then(() => { 71e41f4b71Sopenharmony_ci console.log(`sendShortMessage success`); 72e41f4b71Sopenharmony_ci}).catch(err => { 73e41f4b71Sopenharmony_ci console.error(`sendShortMessage failed, promise: err->${JSON.stringify(err)}`); 74e41f4b71Sopenharmony_ci}); 75e41f4b71Sopenharmony_ci 76e41f4b71Sopenharmony_ci``` 77e41f4b71Sopenharmony_ci 78e41f4b71Sopenharmony_ci## cl.telephony.2 SIM Module API Change 79e41f4b71Sopenharmony_ci 80e41f4b71Sopenharmony_ciChanged the required permission of **getSimTelephoneNumber** from **ohos.permission.GET_TELEPHONY_STATE** to **ohos.permission.GET_PHONE_NUMBERS**. 81e41f4b71Sopenharmony_ci 82e41f4b71Sopenharmony_ci**Change Impact** 83e41f4b71Sopenharmony_ci 84e41f4b71Sopenharmony_ciThe required permission of **getSimTelephoneNumber** is from **ohos.permission.GET_TELEPHONY_STATE** to **ohos.permission.GET_PHONE_NUMBERS** since API version 10. 85e41f4b71Sopenharmony_ci 86e41f4b71Sopenharmony_ciAn application needs to be apply for the **ohos.permission.GET_PHONE_NUMBERS** permission. The API function remains unchanged. 87e41f4b71Sopenharmony_ci 88e41f4b71Sopenharmony_ci**Key API/Component Changes** 89e41f4b71Sopenharmony_ci 90e41f4b71Sopenharmony_ciAPI before change: 91e41f4b71Sopenharmony_ci 92e41f4b71Sopenharmony_ci```js 93e41f4b71Sopenharmony_ci @permission ohos.permission.GET_TELEPHONY_STATE 94e41f4b71Sopenharmony_ci function getSimTelephoneNumber(slotId: number, callback: AsyncCallback<string>): void; 95e41f4b71Sopenharmony_ci 96e41f4b71Sopenharmony_ci @permission ohos.permission.GET_TELEPHONY_STATE 97e41f4b71Sopenharmony_ci function getSimTelephoneNumber(slotId: number): Promise<string>; 98e41f4b71Sopenharmony_ci``` 99e41f4b71Sopenharmony_ci 100e41f4b71Sopenharmony_ciAPI after change: 101e41f4b71Sopenharmony_ci 102e41f4b71Sopenharmony_ci```js 103e41f4b71Sopenharmony_ci @permission ohos.permission.GET_PHONE_NUMBERS 104e41f4b71Sopenharmony_ci function getSimTelephoneNumber(slotId: number, callback: AsyncCallback<string>): void; 105e41f4b71Sopenharmony_ci 106e41f4b71Sopenharmony_ci @permission ohos.permission.GET_PHONE_NUMBERS 107e41f4b71Sopenharmony_ci function getSimTelephoneNumber(slotId: number): Promise<string>; 108e41f4b71Sopenharmony_ci``` 109e41f4b71Sopenharmony_ci 110e41f4b71Sopenharmony_ci 111e41f4b71Sopenharmony_ci 112e41f4b71Sopenharmony_ci**Adaptation Guide** 113e41f4b71Sopenharmony_ci 114e41f4b71Sopenharmony_ciUse the new API. 115e41f4b71Sopenharmony_ci 116e41f4b71Sopenharmony_ciIn the **module.json** file, add the **ohos.permission.GET_PHONE_NUMBERS** permission or replace the existing permission with it. The sample code is as follows: 117e41f4b71Sopenharmony_ci 118e41f4b71Sopenharmony_ci```js 119e41f4b71Sopenharmony_ci"requestPermissions" : [ 120e41f4b71Sopenharmony_ci { 121e41f4b71Sopenharmony_ci "name": "ohos.permission.GET_PHONE_NUMBERS", 122e41f4b71Sopenharmony_ci "reason": "$string:GET_PHONE_NUMBERS" 123e41f4b71Sopenharmony_ci } 124e41f4b71Sopenharmony_ci] 125e41f4b71Sopenharmony_ci``` 126