diff --git a/en/application-dev/reference/apis/js-apis-sms.md b/en/application-dev/reference/apis/js-apis-sms.md index e428eaa609d028073417c7759d3b0c645e5f80a7..41a3fe10bbda7d00fc5aa588ed75072a702971bb 100644 --- a/en/application-dev/reference/apis/js-apis-sms.md +++ b/en/application-dev/reference/apis/js-apis-sms.md @@ -135,10 +135,10 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -let sendCallback = function (err, data) { +let sendCallback = function (err, data) { console.log(`sendCallback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); } -let deliveryCallback = function (err, data) { +let deliveryCallback = function (err, data) { console.log(`deliveryCallback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); } let slotId = 0; diff --git a/zh-cn/application-dev/reference/apis/js-apis-sms.md b/zh-cn/application-dev/reference/apis/js-apis-sms.md index e3377be097917dd1267707c6f0b130284556ecb6..a5e3f36cd6a4a390db28a3a474d056ae35cbceaa 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-sms.md +++ b/zh-cn/application-dev/reference/apis/js-apis-sms.md @@ -135,10 +135,10 @@ sendMessage\(options: SendMessageOptions\): void **示例:** ```js -let sendCallback = function (err, data) { +let sendCallback = function (err, data) { console.log(`sendCallback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); } -let deliveryCallback = function (err, data) { +let deliveryCallback = function (err, data) { console.log(`deliveryCallback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); } let slotId = 0; diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.10.1/changelogs-telephony.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.10.1/changelogs-telephony.md new file mode 100644 index 0000000000000000000000000000000000000000..86c1b04e0f425e2fc5ba3cf4686e12cbc72751cb --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.10.1/changelogs-telephony.md @@ -0,0 +1,72 @@ +# 电话子系统ChangeLog + + + +## cl.telephony.1 sms模块接口变更 + +sendMessage接口作废弃处理,变更为sendShortMessage接口。 + +**变更影响** + +从API version 10开始,sendMessage接口废弃。应用需要自行适配为sendShortMessage。接口功能不变。 + +**关键的接口/组件变更** + +修改前的接口原型: + +```js +function sendMessage(options: SendMessageOptions): void; +``` + +修改后的接口原型: + +```js +function sendShortMessage(options: SendMessageOptions, callback: AsyncCallback): void; +function sendShortMessage(options: SendMessageOptions): Promise; +``` + + + +**适配指导** + +使用变更后的接口,示例代码如下: + +```js +let sendCallback = function (err, data) { + console.log(`sendCallback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +} +let deliveryCallback = function (err, data) { + console.log(`deliveryCallback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +} +let slotId = 0; +let content = '短信内容'; +let destinationHost = '+861xxxxxxxxxx'; +let serviceCenter = '+861xxxxxxxxxx'; +let destinationPort = 1000; +let options = {slotId, content, destinationHost, serviceCenter, destinationPort, sendCallback, deliveryCallback}; +sms.sendShortMessage(options, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); +}); +``` + +```js +let sendCallback = function (err, data) { + console.log(`sendCallback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +} +let deliveryCallback = function (err, data) { + console.log(`deliveryCallback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +} +let slotId = 0; +let content = '短信内容'; +let destinationHost = '+861xxxxxxxxxx'; +let serviceCenter = '+861xxxxxxxxxx'; +let destinationPort = 1000; +let options = {slotId, content, destinationHost, serviceCenter, destinationPort, sendCallback, deliveryCallback}; +let promise = sms.sendShortMessage(options); +promise.then(() => { + console.log(`sendShortMessage success`); +}).catch(err => { + console.error(`sendShortMessage failed, promise: err->${JSON.stringify(err)}`); +}); + +```