harmony 鸿蒙@ohos.telephony.sms (SMS)

2022-08-09 浏览 (778)

@ohos.telephony.sms (SMS)

The 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.

NOTE

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.

Modules to Import

import sms from '@ohos.telephony.sms';

sms.createMessage

createMessage(pdu: Array<number>, specification: string, callback: AsyncCallback<ShortMessage>): void

Creates an SMS instance based on the protocol data unit (PDU) and specified SMS protocol. This API uses an asynchronous callback to return the result.

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
pduArray<number>YesProtocol data unit, which is obtained from the received SMS message.
specificationstringYesSMS protocol type.
- 3gpp: GSM/UMTS/LTE SMS
- 3gpp2: CDMA SMS
callbackAsyncCallback<ShortMessage>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

const specification: string = '3gpp';
// Display PDUs using numbers in an array, for example, [0x08, 0x91, ...].
const pdu: Array<number> = [0x08, 0x91];
sms.createMessage(pdu, specification, (err: BusinessError, data: sms.ShortMessage) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

sms.createMessage

createMessage(pdu: Array<number>, specification: string): Promise<ShortMessage>

Creates an SMS instance based on the PDU and specified SMS protocol. This API uses a promise to return the result.

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
pduArray<number>YesProtocol data unit, which is obtained from the received SMS message.
specificationstringYesSMS protocol type.
- 3gpp: GSM/UMTS/LTE SMS
- 3gpp2: CDMA SMS

Return value

TypeDescription
Promise<ShortMessage>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

const specification: string = '3gpp';
// Display PDUs using numbers in an array, for example, [0x08, 0x91, ...].
const pdu: Array<number> = [0x08, 0x91];
sms.createMessage(pdu, specification).then((data: sms.ShortMessage) => {
    console.log(`createMessage success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`createMessage failed, promise: err->${JSON.stringify(err)}`);
});

sms.sendMessage(deprecated)

sendMessage(options: SendMessageOptions): void

Sends an SMS message.

NOTE

This API is supported since API version 8 and deprecated since API version 10. You are advised to use sendShortMessage.

Required permissions: ohos.permission.SEND_MESSAGES

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
optionsSendMessageOptionsYesOptions (including the callback) for sending SMS messages. For details, see SendMessageOptions.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { AsyncCallback } from '@ohos.base';
import { BusinessError } from '@ohos.base';

let sendCallback: AsyncCallback<sms.ISendShortMessageCallback> = (err: BusinessError, data: sms.ISendShortMessageCallback) => {
    console.log(`sendCallback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 
}
let deliveryCallback: AsyncCallback<sms.IDeliveryShortMessageCallback> = (err: BusinessError, data: sms.IDeliveryShortMessageCallback) => {
    console.log(`deliveryCallback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 
}
let options: sms.SendMessageOptions = {
    slotId: 0,
    content: 'SMS message content';
    destinationHost: '+861xxxxxxxxxx',
    serviceCenter: '+861xxxxxxxxxx',
    destinationPort: 1000,
    sendCallback: sendCallback,
    deliveryCallback: deliveryCallback
};
sms.sendMessage(options);

sms.sendShortMessage10+

sendShortMessage(options: SendMessageOptions, callback: AsyncCallback<void>): void

Sends an SMS message. This API uses an asynchronous callback to return the result.

Required permissions: ohos.permission.SEND_MESSAGES

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
optionsSendMessageOptionsYesOptions (including the callback) for sending SMS messages. For details, see SendMessageOptions.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { AsyncCallback } from '@ohos.base';
import { BusinessError } from '@ohos.base';

let sendCallback: AsyncCallback<sms.ISendShortMessageCallback> = (err: BusinessError, data: sms.ISendShortMessageCallback) => {
    console.log(`sendCallback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}
let deliveryCallback: AsyncCallback<sms.IDeliveryShortMessageCallback> = (err: BusinessError, data: sms.IDeliveryShortMessageCallback) => {
    console.log(`deliveryCallback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}
let options: sms.SendMessageOptions = {
    slotId: 0,
    content: 'SMS message content';
    destinationHost: '+861xxxxxxxxxx',
    serviceCenter: '+861xxxxxxxxxx',
    destinationPort: 1000,
    sendCallback: sendCallback,
    deliveryCallback: deliveryCallback
};
sms.sendShortMessage(options, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}`);
});

sms.sendShortMessage10+

sendShortMessage(options: SendMessageOptions): Promise<void>

Sends an SMS message. This API uses a promise to return the result.

Required permissions: ohos.permission.SEND_MESSAGES

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
optionsSendMessageOptionsYesOptions (including the callback) for sending SMS messages. For details, see SendMessageOptions.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { AsyncCallback } from '@ohos.base';
import { BusinessError } from '@ohos.base';

let sendCallback: AsyncCallback<sms.ISendShortMessageCallback> = (err: BusinessError, data: sms.ISendShortMessageCallback) => {
    console.log(`sendCallback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}
let deliveryCallback: AsyncCallback<sms.IDeliveryShortMessageCallback> = (err: BusinessError, data: sms.IDeliveryShortMessageCallback) => {
    console.log(`deliveryCallback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}
let options: sms.SendMessageOptions = {
    slotId: 0,
    content: 'SMS message content';
    destinationHost: '+861xxxxxxxxxx',
    serviceCenter: '+861xxxxxxxxxx',
    destinationPort: 1000,
    sendCallback: sendCallback,
    deliveryCallback: deliveryCallback
};
let promise = sms.sendShortMessage(options);
promise.then(() => {
    console.log(`sendShortMessage success`);
}).catch((err: BusinessError) => {
    console.error(`sendShortMessage failed, promise: err->${JSON.stringify(err)}`);
});

sms.sendMms11+

sendMms(context: Context, mmsParams: MmsParams, callback: AsyncCallback<void>): void

Sends an MMS message. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permissions: ohos.permission.SEND_MESSAGES

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
contextContextYesApplication context.
For details about the application context of the FA model, see Context.
For details about the application context of the stage model, see Context.
mmsParamsMmsParamsYesParameters (including the callback) for sending MMS messages. For details, see MmsParams.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

FA model:

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';
import type Context from './application/BaseContext';

// Obtain the context.
import featureAbility from '@ohos.ability.featureAbility';
let context: Context = featureAbility.getContext();

// Configure the path for storing the PDU of the MMS message.
const sandBoxPath: string = '/data/storage/el2/base/files/';
let filePath: string  = sandBoxPath + 'SendReq.mms';

// Options for sending MMS messages (The MMSC is for reference only.)
let mmsPars: sms.MmsParam = {
  slotId : 0,
  mmsc: 'http://mmsc.myuni.com.cn',
  data: filePath,
  mmsConfig: {
   userAgent:'ua',
   userAgentProfile: 'uaprof'
  }
};

// Call the sendMms API.
sms.sendMms(context, mmsPars, async(err: BusinessError) =>{
  if (err) {
    console.log(`sendMms fail, err : ${String(err)}`);
    return;
  }
  console.log(`sendMms Success`);
})

Stage model:

import UIAbility from '@ohos.app.ability.UIAbility';

// Configure the path for storing the PDU of the MMS message.
const sandBoxPath = '/data/storage/el2/base/files/';
let filePath  = sandBoxPath + 'SendReq.mms';

// Configure the MMS user agent and profile. The default values are ua an uaprof, respectively. The configuration is subject to the carrier's requirements. 
let mmsConf = {
  userAgent:'ua',
  userAgentProfile: 'uaprof'
};

// Options for sending MMS messages (The MMSC is for reference only.)
let mmsPars = {
  slotId : DEFAULT_SLOTID,
  mmsc: 'http://mmsc.myuni.com.cn',
  data: filePath,
  mmsConfig: mmsConf
};

class EntryAbility extends UIAbility {
    onWindowStageCreate(windowStage) {
    sms.sendMms(this.context, mmsPars, async(err) =>{
        if (err) {
            console.log(`sendMms fail, err : ${String(err)}`);
            return;
        }
        console.log(`sendMms Success`);
        })
    }
}

sms.sendMms11+

sendMms(context: Context, mmsParams: MmsParams): Promise<void>

Sends an MMS message. This API uses a promise to return the result.

System API: This is a system API.

Required permissions: ohos.permission.SEND_MESSAGES

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
contextContextYesApplication context.
For details about the application context of the FA model, see Context.
For details about the application context of the stage model, see Context.
mmsParamsMmsParamsYesParameters (including the callback) for sending MMS messages. For details, see MmsParams.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

FA model:

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';
import type Context from './application/BaseContext';
// Obtain the context.
import featureAbility from '@ohos.ability.featureAbility';
let context: Context = featureAbility.getContext();

// Configure the path for storing the PDU of the MMS message.
const sandBoxPath: string = '/data/storage/el2/base/files/';
let filePath: string = sandBoxPath + 'SendReq.mms';

// Options for sending MMS messages (The MMSC is for reference only.)
let mmsPars: sms.MmsParam = {
  slotId: 0,
  mmsc: 'http://mmsc.myuni.com.cn',
  data: filePath,
  mmsConfig: {
   userAgent:'ua',
   userAgentProfile: 'uaprof'
  }
};

// Call the sendMms API.
let promise = sms.sendMms(context, mmsPars);
promise.then(() => {
    console.log(`sendMms success`);
}).catch((err: BusinessError) => {
    console.error(`sendMms failed, promise: err->${JSON.stringify(err)}`);
});

Stage model:

import UIAbility from '@ohos.app.ability.UIAbility';

// Configure the path for storing the PDU of the MMS message.
const sandBoxPath = '/data/storage/el2/base/files/';
let filePath  = sandBoxPath + 'SendReq.mms';

// Configure the MMS user agent and profile. The default values are ua an uaprof, respectively. The configuration is subject to the carrier's requirements. 
let mmsConf = {
  userAgent:'ua',
  userAgentProfile: 'uaprof'
};

// Options for sending MMS messages (The MMSC is for reference only.)
let mmsPars = {
  slotId : DEFAULT_SLOTID,
  mmsc: 'http://mmsc.myuni.com.cn',
  data: filePath,
  mmsConfig: mmsConf
};

class EntryAbility extends UIAbility {
    onWindowStageCreate(windowStage) {
    let promise = sms.sendMms(this.context, mmsPars);
    promise.then(() => {
        console.log(`sendMms success`);
    }).catch(err => {
        console.error(`sendMms failed, promise: err->${JSON.stringify(err)}`);
    });
    }
}

sms.downloadMms11+

downloadMms(context: Context, mmsParams: MmsParams, callback: AsyncCallback<void>): void

Downloads an MMS message. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permissions: ohos.permission.RECEIVE_MMS

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
contextContextYesApplication context.
For details about the application context of the FA model, see Context.
For details about the application context of the stage model, see Context.
mmsParamsMmsParamsYesParameters (including the callback) for downloading MMS messages. For details, see MmsParams.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

FA model:

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';
import type Context from './application/BaseContext';
// Obtain the context.
import featureAbility from '@ohos.ability.featureAbility';
let context: Context = featureAbility.getContext();

// Configure the path for storing the PDU of the MMS message.
const sandBoxPath: string = '/data/storage/el2/base/files/';
let filePath: string = sandBoxPath + 'RetrieveConf.mms';

// Parse the MMS URL from the WAP Push message.
let wapPushUrl: string = 'URL';

// Configure the parameters (including the callback) for downloading MMS messages.
let mmsPars: sms.MmsParam = {
  slotId: 0,
  mmsc: wapPushUrl,
  data: filePath,
  mmsConfig: {
   userAgent:'ua',
   userAgentProfile: 'uaprof'
  }
};

// Call the downloadMms API.
mms.downloadMms(context, mmsPars, async(err: BusinessError) =>{
  if (err) {
    console.log(`downloadMms fail, err : ${toString(err)}`);
    return;
  }
  console.log(`downloadMms Success`);
}

Stage model:

import UIAbility from '@ohos.app.ability.UIAbility';

// Configure the path for storing the PDU of the MMS message.
const sandBoxPath = '/data/storage/el2/base/files/';
let filePath  = sandBoxPath + 'RetrieveConf.mms';

// Parse the MMS URL from the WAP Push message.
let wapPushUrl  = 'URL';

// Configure the MMS user agent and profile. The default values are ua an uaprof, respectively. The configuration is subject to the carrier's requirements. 
let mmsConf = {
  userAgent:'ua',
  userAgentProfile: 'uaprof'
};

// Configure the parameters (including the callback) for downloading MMS messages.
let mmsPars = {
  slotId : DEFAULT_SLOTID,
  mmsc: wapPushUrl,
  data: filePath,
  mmsConfig: mmsConf
};

class EntryAbility extends UIAbility {
    onWindowStageCreate(windowStage) {
    mms.downloadMms(this.context, mmsPars, async(err) =>{
        if (err) {
            console.log(`downloadMms fail, err : ${toString(err)}`);
            return;
        }
        console.log(`downloadMms Success`);
        }
    }
}

sms.downloadMms11+

downloadMms(context: Context, mmsParams: MmsParams): Promise<void>

Sends an MMS message. This API uses a promise to return the result.

System API: This is a system API.

Required permissions: ohos.permission.RECEIVE_MMS

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
contextContextYesApplication context.
For details about the application context of the FA model, see Context.
For details about the application context of the stage model, see Context.
mmsParamsMmsParamsYesParameters (including the callback) for sending MMS messages. For details, see MmsParams.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

FA model:

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';
import type Context from './application/BaseContext';
// Obtain the context.
import featureAbility from '@ohos.ability.featureAbility';
let context: Context = featureAbility.getContext();

// Configure the path for storing the PDU of the MMS message.
const sandBoxPath: string = '/data/storage/el2/base/files/';
let filePath: string = sandBoxPath + 'RetrieveConf.mms';

// Parse the MMS URL from the WAP Push message.
let wapPushUrl: string = 'URL';

// Configure the parameters (including the callback) for downloading MMS messages.
let mmsPars: sms.MmsParam = {
  slotId: 0,
  mmsc: wapPushUrl,
  data: filePath,
  mmsConfig: {
   userAgent:'ua',
   userAgentProfile: 'uaprof'
  }
};

// Call the sendMms API.
let promise = sms.downloadMms(context, mmsPars);
promise.then(() => {
    console.log(`downloadMms success`);
}).catch((err: BusinessError) => {
    console.error(`downloadMms failed, promise: err->${JSON.stringify(err)}`);
});

Stage model:

import UIAbility from '@ohos.app.ability.UIAbility';

// Configure the path for storing the PDU of the MMS message.
const sandBoxPath = '/data/storage/el2/base/files/';
let filePath  = sandBoxPath + 'RetrieveConf.mms';

// Parse the MMS URL from the WAP Push message.
let wapPushUrl  = 'URL';

// Configure the MMS user agent and profile. The default values are ua an uaprof, respectively. The configuration is subject to the carrier's requirements. 
let mmsConf = {
  userAgent:'ua',
  userAgentProfile: 'uaprof'
};

// Configure the parameters (including the callback) for downloading MMS messages.
let mmsPars = {
  slotId : DEFAULT_SLOTID,
  mmsc: wapPushUrl,
  data: filePath,
  mmsConfig: mmsConf
};

class EntryAbility extends UIAbility {
    onWindowStageCreate(windowStage) {
    let promise = sms.downloadMms(this.context, mmsPars);
    promise.then(() => {
        console.log(`downloadMms success`);
    }).catch(err => {
        console.error(`downloadMms failed, promise: err->${JSON.stringify(err)}`);
    });
    }
}

sms.getDefaultSmsSlotId7+

getDefaultSmsSlotId(callback: AsyncCallback<number>): void

Obtains the default slot ID of the SIM card used to send SMS messages. This API uses an asynchronous callback to return the result.

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<number>YesCallback used to return the result.
- 0: card slot 1
- 1: card slot 2

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

sms.getDefaultSmsSlotId((err: BusinessError, data: number) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

sms.getDefaultSmsSlotId7+

getDefaultSmsSlotId(): Promise<number>

Obtains the default slot ID of the SIM card used to send SMS messages. This API uses a promise to return the result.

System capability: SystemCapability.Telephony.SmsMms

Return value

TypeDescription
Promise<number>Promise used to return the result.
- 0: card slot 1
- 1: card slot 2

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

sms.getDefaultSmsSlotId().then((data: number) => {
    console.log(`getDefaultSmsSlotId success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`getDefaultSmsSlotId failed, promise: err->${JSON.stringify(err)}`);
});

sms.setDefaultSmsSlotId7+

setDefaultSmsSlotId(slotId: number, callback: AsyncCallback<void>): void

Sets the default slot ID of the SIM card used to send SMS messages. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permissions: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
slotIdnumberYesSIM card slot ID.
- 0: card slot 1
- 1: card slot 2
- -1: Clears the default configuration.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300004Do not have sim card.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

sms.setDefaultSmsSlotId(0, (err: BusinessError) => {
    console.log(`callback: err->${JSON.stringify(err)}.`);
});

sms.setDefaultSmsSlotId7+

setDefaultSmsSlotId(slotId: number): Promise<void>

Sets the default slot ID of the SIM card used to send SMS messages. This API uses a promise to return the result.

System API: This is a system API.

Required permissions: ohos.permission.SET_TELEPHONY_STATE

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
slotIdnumberYesSIM card slot ID.
- 0: card slot 1
- 1: card slot 2
- -1: Clears the default configuration.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300004Do not have sim card.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

sms.setDefaultSmsSlotId(0).then(() => {
    console.log(`setDefaultSmsSlotId success.`);
}).catch((err: BusinessError) => {
    console.error(`setDefaultSmsSlotId failed, promise: err->${JSON.stringify(err)}`);
});

sms.setSmscAddr7+

setSmscAddr(slotId: number, smscAddr: string, callback: AsyncCallback<void>): void

Sets the short message service center (SMSC) address. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permissions: ohos.permission.SET_TELEPHONY_STATE (a system permission)

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
slotIdnumberYesSIM card slot ID.
- 0: card slot 1
- 1: card slot 2
smscAddrstringYesSMSC address.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let slotId: number = 0;
let smscAddr: string = '+861xxxxxxxxxx';
sms.setSmscAddr(slotId, smscAddr, (err: BusinessError) => {
      console.log(`callback: err->${JSON.stringify(err)}`);
});

sms.setSmscAddr7+

setSmscAddr(slotId: number, smscAddr: string): Promise<void>

Sets the SMSC address. This API uses a promise to return the result.

System API: This is a system API.

Required permissions: ohos.permission.SET_TELEPHONY_STATE (a system permission)

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
slotIdnumberYesSIM card slot ID.
- 0: card slot 1
- 1: card slot 2
smscAddrstringYesSMSC address.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let slotId: number = 0;
let smscAddr: string = '+861xxxxxxxxxx';
sms.setSmscAddr(slotId, smscAddr).then(() => {
    console.log(`setSmscAddr success.`);
}).catch((err: BusinessError) => {
    console.error(`setSmscAddr failed, promise: err->${JSON.stringify(err)}`);
});

sms.getSmscAddr7+

getSmscAddr(slotId: number, callback: AsyncCallback<string>): void

Obtains the SMSC address. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permissions: ohos.permission.GET_TELEPHONY_STATE (a system permission)

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
slotIdnumberYesSIM card slot ID.
- 0: card slot 1
- 1: card slot 2
callbackAsyncCallback<string>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let slotId: number = 0;
sms.getSmscAddr(slotId, (err: BusinessError, data: string) => {
      console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

sms.getSmscAddr7+

getSmscAddr(slotId: number): Promise<string>

Obtains the SMSC address. This API uses a promise to return the result.

System API: This is a system API.

Required permissions: ohos.permission.GET_TELEPHONY_STATE (a system permission)

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
slotIdnumberYesSIM card slot ID.
- 0: card slot 1
- 1: card slot 2

Return value

TypeDescription
Promise<string>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let slotId: number = 0;
sms.getSmscAddr(slotId).then((data: string) => {
    console.log(`getSmscAddr success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`getSmscAddr failed, promise: err->${JSON.stringify(err)}`);
});

sms.hasSmsCapability7+

hasSmsCapability(): boolean

Checks whether the current device can send and receive SMS messages. This API works in synchronous mode.

System capability: SystemCapability.Telephony.SmsMms

Return value

TypeDescription
boolean- true: The device can send and receive SMS messages.
- false: The device cannot send or receive SMS messages.
import sms from '@ohos.telephony.sms';

let result = sms.hasSmsCapability(); 
console.log(`hasSmsCapability: ${JSON.stringify(result)}`);

sms.splitMessage8+

splitMessage(content: string, callback: AsyncCallback<Array<string>>): void

Splits an SMS message into multiple segments. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permissions: ohos.permission.SEND_MESSAGES

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
contentstringYesSMS message content. The value cannot be null.
callbackAsyncCallback<Array<string>>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let content: string = "long message";
sms.splitMessage(content, (err: BusinessError, data: string[]) => {
      console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

sms.splitMessage8+

splitMessage(content: string): Promise<Array<string>>

Splits an SMS message into multiple segments. This API uses a promise to return the result.

System API: This is a system API.

Required permissions: ohos.permission.SEND_MESSAGES

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
contentstringYesSMS message content. The value cannot be null.

Return value

TypeDescription
Promise<Array<string>>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let content: string = "long message";
let promise = sms.splitMessage(content);
promise.then((data: string[]) => {
    console.log(`splitMessage success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`splitMessage failed, promise: err->${JSON.stringify(err)}`);
});

sms.addSimMessage7+

addSimMessage(options: SimMessageOptions, callback: AsyncCallback<void>): void

Adds a SIM message. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permissions: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
optionsSimMessageOptionsYesSIM message options.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let simMessageOptions: sms.SimMessageOptions = {
    slotId: 0,
    smsc: "test",
    pdu: "xxxxxx",
    status: sms.SimMessageStatus.SIM_MESSAGE_STATUS_READ
};
sms.addSimMessage(simMessageOptions, (err: BusinessError) => {
      console.log(`callback: err->${JSON.stringify(err)}`);
});

sms.addSimMessage7+

addSimMessage(options: SimMessageOptions): Promise<void>

Adds a SIM message. This API uses a promise to return the result.

System API: This is a system API.

Required permissions: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
optionsSimMessageOptionsYesSIM message options.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let simMessageOptions: sms.SimMessageOptions = {
    slotId: 0,
    smsc: "test",
    pdu: "xxxxxx",
    status: sms.SimMessageStatus.SIM_MESSAGE_STATUS_READ
};
sms.addSimMessage(simMessageOptions).then(() => {
    console.log(`addSimMessage success.`);
}).catch((err: BusinessError) => {
    console.error(`addSimMessage failed, promise: err->${JSON.stringify(err)}`);
});

sms.delSimMessage7+

delSimMessage(slotId: number, msgIndex: number, callback: AsyncCallback<void>): void

Deletes a SIM message. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permissions: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
slotIdnumberYesSIM card slot ID.
- 0: card slot 1
- 1: card slot 2
msgIndexnumberYesMessage index.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let slotId: number = 0;
let msgIndex: number = 1;
sms.delSimMessage(slotId, msgIndex, (err: BusinessError) => {
      console.log(`callback: err->${JSON.stringify(err)}`);
});

sms.delSimMessage7+

delSimMessage(slotId: number, msgIndex: number): Promise<void>

Deletes a SIM message. This API uses a promise to return the result.

System API: This is a system API.

Required permissions: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
slotIdnumberYesSIM card slot ID.
- 0: card slot 1
- 1: card slot 2
msgIndexnumberYesMessage index.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let slotId: number = 0;
let msgIndex: number = 1;
let promise = sms.delSimMessage(slotId, msgIndex);
promise.then(() => {
    console.log(`delSimMessage success.`);
}).catch((err: BusinessError) => {
    console.error(`delSimMessage failed, promise: err->${JSON.stringify(err)}`);
});

sms.updateSimMessage7+

updateSimMessage(options: UpdateSimMessageOptions, callback: AsyncCallback<void>): void

Updates a SIM message. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permissions: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
optionsUpdateSimMessageOptionsYesSIM message updating options.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let updateSimMessageOptions: sms.UpdateSimMessageOptions = {
    slotId: 0,
    msgIndex: 1,
    newStatus: sms.SimMessageStatus.SIM_MESSAGE_STATUS_FREE,
    pdu: "xxxxxxx",
    smsc: "test"
};
sms.updateSimMessage(updateSimMessageOptions, (err: BusinessError) => {
      console.log(`callback: err->${JSON.stringify(err)}`);
});

sms.updateSimMessage7+

updateSimMessage(options: UpdateSimMessageOptions): Promise<void>

Updates a SIM message. This API uses a promise to return the result.

System API: This is a system API.

Required permissions: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
optionsUpdateSimMessageOptionsYesSIM message updating options.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let updateSimMessageOptions: sms.UpdateSimMessageOptions = {
    slotId: 0,
    msgIndex: 1,
    newStatus: sms.SimMessageStatus.SIM_MESSAGE_STATUS_FREE,
    pdu: "xxxxxxx",
    smsc: "test"
};
let promise = sms.updateSimMessage(updateSimMessageOptions);
promise.then(() => {
    console.log(`updateSimMessage success.`);
}).catch((err: BusinessError) => {
    console.error(`updateSimMessage failed, promise: err->${JSON.stringify(err)}`);
});

sms.getAllSimMessages7+

getAllSimMessages(slotId: number, callback: AsyncCallback<Array<SimShortMessage>>): void

Obtains all SIM card messages. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permissions: ohos.permission.RECEIVE_SMS

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
slotIdnumberYesSIM card slot ID.
- 0: card slot 1
- 1: card slot 2
callbackAsyncCallback<Array<SimShortMessage>>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let slotId: number = 0;
sms.getAllSimMessages(slotId, (err: BusinessError, data: sms.SimShortMessage[]) => {
      console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

sms.getAllSimMessages7+

getAllSimMessages(slotId: number): Promise<Array<SimShortMessage>>

Obtains all SIM card messages. This API uses a promise to return the result.

System API: This is a system API.

Required permissions: ohos.permission.RECEIVE_SMS

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
slotIdnumberYesSIM card slot ID.
- 0: card slot 1
- 1: card slot 2

Return value

TypeDescription
PromiseArray<SimShortMessage>>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let slotId: number = 0;
let promise = sms.getAllSimMessages(slotId);
promise.then((data: sms.SimShortMessage) => {
    console.log(`getAllSimMessages success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`getAllSimMessages failed, promise: err->${JSON.stringify(err)}`);
});

sms.setCBConfig7+

setCBConfig(options: CBConfigOptions, callback: AsyncCallback<void>): void

Sets the cell broadcast configuration. This API uses an asynchronous callback to return the result.

System API: This is a system API.

Required permissions: ohos.permission.RECEIVE_SMS

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
optionsCBConfigOptionsYesCell broadcast configuration options.
callbackAsyncCallback<void>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let cbConfigOptions: sms.CBConfigOptions = {
    slotId: 0,
    enable: true,
    startMessageId: 100,
    endMessageId: 200,
    ranType: sms.RanType.TYPE_GSM
};
sms.setCBConfig(cbConfigOptions, (err: BusinessError) => {
      console.log(`callback: err->${JSON.stringify(err)}`);
});

sms.setCBConfig7+

setCBConfig(options: CBConfigOptions): Promise<void>

Sets the cell broadcast configuration. This API uses a promise to return the result.

System API: This is a system API.

Required permissions: ohos.permission.RECEIVE_SMS

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
optionsCBConfigOptionsYesCell broadcast configuration options.

Return value

TypeDescription
Promise<void>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
201Permission denied.
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let cbConfigOptions: sms.CBConfigOptions = {
    slotId: 0,
    enable: true,
    startMessageId: 100,
    endMessageId: 200,
    ranType: sms.RanType.TYPE_GSM
};
let promise = sms.setCBConfig(cbConfigOptions);
promise.then(() => {
    console.log(`setCBConfig success.`);
}).catch((err: BusinessError) => {
    console.error(`setCBConfig failed, promise: err->${JSON.stringify(err)}`);
});

sms.getSmsSegmentsInfo8+

getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean, callback: AsyncCallback<SmsSegmentsInfo>): void

Obtains SMS message segment information. This API uses an asynchronous callback to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
slotIdnumberYesSIM card slot ID.
- 0: card slot 1
- 1: card slot 2
messagestringYesSMS message.
force7bitbooleanYesWhether to use 7-bit coding.
callbackAsyncCallback<SmsSegmentsInfo>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let slotId: number = 0;
sms.getSmsSegmentsInfo(slotId, "message", false, (err: BusinessError, data: sms.SmsSegmentsInfo) => {
      console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

sms.getSmsSegmentsInfo8+

getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean): Promise<SmsSegmentsInfo>

Obtains SMS message segment information. This API uses a promise to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
slotIdnumberYesSIM card slot ID.
- 0: card slot 1
- 1: card slot 2
messagestringYesSMS message.
force7bitbooleanYesWhether to use 7-bit coding.

Return value

TypeDescription
Promise<SmsSegmentsInfo>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let slotId: number = 0;
let promise = sms.getSmsSegmentsInfo(slotId, "message", false);
promise.then((data: sms.SmsSegmentsInfo) => {
    console.log(`getSmsSegmentsInfo success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`getSmsSegmentsInfo failed, promise: err->${JSON.stringify(err)}`);
});

sms.isImsSmsSupported8+

isImsSmsSupported(slotId: number, callback: AsyncCallback<boolean>): void

Checks whether SMS is supported on IMS. This API uses an asynchronous callback to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
slotIdnumberYesSIM card slot ID.
- 0: card slot 1
- 1: card slot 2
callbackAsyncCallback<boolean>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let slotId: number = 0;
sms.isImsSmsSupported(slotId, (err: BusinessError, data: boolean) => {
      console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

sms.isImsSmsSupported8+

isImsSmsSupported(slotId: number): Promise<boolean>

Checks whether SMS is supported on IMS. This API uses a promise to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
- 0: card slot 1
- 1: card slot 2

Return value

TypeDescription
Promise<boolean>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let slotId: number = 0;
let promise = sms.isImsSmsSupported(slotId);
promise.then((data: boolean) => {
    console.log(`isImsSmsSupported success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`isImsSmsSupported failed, promise: err->${JSON.stringify(err)}`);
});

sms.getImsShortMessageFormat8+

getImsShortMessageFormat(callback: AsyncCallback<string>): void

Obtains the SMS format supported by the IMS. This API uses an asynchronous callback to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<string>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

sms.getImsShortMessageFormat((err: BusinessError, data: string) => {
      console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

sms.getImsShortMessageFormat8+

getImsShortMessageFormat(): Promise<string>

Obtains the SMS format supported by the IMS. This API uses a promise to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

Return value

TypeDescription
Promise<string>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

sms.getImsShortMessageFormat().then((data: string) => {
    console.log(`getImsShortMessageFormat success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`getImsShortMessageFormat failed, promise: err->${JSON.stringify(err)}`);
});

sms.decodeMms8+

decodeMms(mmsFilePathName: string|Array<number>, callback: AsyncCallback<MmsInformation>): void

Decodes MMS messages. This API uses an asynchronous callback to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
mmsFilePathNamestring |Array<number>YesMMS message file path.
callbackAsyncCallback<MmsInformation>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let mmsFilePathName: string = "filename";
sms.decodeMms(mmsFilePathName, (err: BusinessError, data: sms.MmsInformation) => {
      console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

sms.decodeMms8+

decodeMms(mmsFilePathName: string|Array<number>): Promise<MmsInformation>

Decodes MMS messages. This API uses a promise to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
mmsFilePathNamestring |Array<number>YesMMS message file path.

Return value

TypeDescription
Promise<<MmsInformation>>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let mmsFilePathName: string = "filename";
let promise = sms.decodeMms(mmsFilePathName);
promise.then((data: sms.MmsInformation) => {
    console.log(`decodeMms success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`decodeMms failed, promise: err->${JSON.stringify(err)}`);
});

sms.encodeMms8+

encodeMms(mms: MmsInformation, callback: AsyncCallback<Array<number>>): void

MMS message code. This API uses an asynchronous callback to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
mmsMmsInformationYesMMS message information.
callbackAsyncCallback<Array<number>>YesCallback used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let mmsAcknowledgeInd: sms.MmsAcknowledgeInd = {
    transactionId: "100",
    version: sms.MmsVersionType.MMS_VERSION_1_0,
    reportAllowed: sms.ReportType.MMS_YES
};
let mmsInformation: sms.MmsInformation = {
    messageType: sms.MessageType.TYPE_MMS_ACKNOWLEDGE_IND,
    mmsType: mmsAcknowledgeInd
};
sms.encodeMms(mmsInformation, (err: BusinessError, data: number[]) => {
      console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

sms.encodeMms8+

encodeMms(mms: MmsInformation): Promise<Array<number>>

MMS message code. This API uses a promise to return the result.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
mmsMmsInformationYesMMS message information.

Return value

TypeDescription
Promise<Array<number>>Promise used to return the result.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
202Non-system applications use system APIs.
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300999Unknown error code.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let mmsAcknowledgeInd: sms.MmsAcknowledgeInd = {
    transactionId: "100",
    version: sms.MmsVersionType.MMS_VERSION_1_0,
    reportAllowed: sms.ReportType.MMS_YES
};
let mmsInformation: sms.MmsInformation = {
    messageType: sms.MessageType.TYPE_MMS_ACKNOWLEDGE_IND,
    mmsType: mmsAcknowledgeInd
};
sms.encodeMms(mmsInformation).then((data: number[]) => {
    console.log(`encodeMms success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`encodeMms failed, promise: err->${JSON.stringify(err)}`);
});

sms.getDefaultSmsSimId10+

getDefaultSmsSimId(callback: AsyncCallback<number>): void

Obtains the default ID of the SIM card used to send SMS messages. This API uses an asynchronous callback to return the result.

System capability: SystemCapability.Telephony.SmsMms

Parameters

NameTypeMandatoryDescription
callbackAsyncCallback<number>YesCallback used to return the result.
The return value is bound to the SIM card and increases from 1.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
401Parameter error.
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300004Do not have sim card.
8300999Unknown error code.
8301001SIM card is not activated.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

sms.getDefaultSmsSimId((err: BusinessError, data: number) => {
    console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});

sms.getDefaultSmsSimId10+

getDefaultSmsSimId(): Promise<number>

Obtains the default ID of the SIM card used to send SMS messages. This API uses a promise to return the result.

System capability: SystemCapability.Telephony.SmsMms

Return value

TypeDescription
Promise<number>Promise used to return the result.
The return value is bound to the SIM card and increases from 1.

Error codes

For details about the following error codes, see Telephony Error Codes.

IDError Message
8300001Invalid parameter value.
8300002Operation failed. Cannot connect to service.
8300003System internal error.
8300004Do not have sim card.
8300999Unknown error code.
8301001SIM card is not activated.

Example

import sms from '@ohos.telephony.sms';
import { BusinessError } from '@ohos.base';

let promise = sms.getDefaultSmsSimId();
promise.then((data: number) => {
    console.log(`getDefaultSmsSimId success, promise: data->${JSON.stringify(data)}`);
}).catch((err: BusinessError) => {
    console.error(`getDefaultSmsSimId failed, promise: err->${JSON.stringify(err)}`);
});

ShortMessage

Defines an SMS message instance.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
hasReplyPathbooleanYesWhether the received SMS contains TP-Reply-Path. The default value is false.
TP-Reply-Path: The device returns a response based on the SMSC that sends the SMS message.
isReplaceMessagebooleanYesWhether the received SMS message is a replace short message. The default value is false.
For details, see section 9.2.3.9 in 3GPP TS 23.040.
isSmsStatusReportMessagebooleanYesWhether the received SMS message is an SMS delivery report. The default value is false.
SMS delivery report: a message sent from the SMSC to show the current status of the SMS message you delivered.
messageClassShortMessageClassYesEnumerates SMS message types.
pduArray<number>YesPDU in the SMS message.
protocolIdnumberYesProtocol identifier used for delivering the SMS message.
scAddressstringYesSMSC address.
scTimestampnumberYesSMSC timestamp.
statusnumberYesSMS message status sent by the SMSC in the SMS-STATUS-REPORT message.
visibleMessageBodystringYesSMS message body.
visibleRawAddressstringYesSender address.

ShortMessageClass

Enumerates SMS message types.

System capability: SystemCapability.Telephony.SmsMms

NameValueDescription
UNKNOWN0Unknown type.
INSTANT_MESSAGE1Instant message, which is displayed immediately after being received.
OPTIONAL_MESSAGE2Message stored in the device or SIM card.
SIM_MESSAGE3Message containing SIM card information, which is to be stored in the SIM card.
FORWARD_MESSAGE4Message to be forwarded to another device.

SendMessageOptions

Provides the options (including callbacks) for sending SMS messages. For example, you can specify the SMS message type by the optional parameter content.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
slotIdnumberYesSlot ID of the SIM card used for sending SMS messages.
- 0: card slot 1
- 1: card slot 2
destinationHoststringYesDestination address of the SMS message.
contentstring |Array<number>YesSMS 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.
serviceCenterstringNoSMSC address. By default, the SMSC address in the SIM card is used.
destinationPortnumberNoDestination port of the SMS message. This field is mandatory only for a data message. Otherwise, it is optional.
sendCallbackAsyncCallback<ISendShortMessageCallback>NoCallback used to return the SMS message sending result. For details, see ISendShortMessageCallback.
deliveryCallbackAsyncCallback<IDeliveryShortMessageCallback>NoCallback used to return the SMS message delivery report. For details, see IDeliveryShortMessageCallback.

MmsParams11+

Defines the parameters for sending SMS messages.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
slotId11+numberYesSlot ID of the SIM card used for sending SMS messages.
- 0: card slot 1
- 1: card slot 2
mmsc11+stringYesMMSC address.
data11+stringYesMMS PDU address.
mmsConfig11+MmsConfigNoMMS configuration file. For details, see MmsConfig.

MmsConfig11+

MMS configuration file.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
userAgent11+stringYesUser agent.
userAgentProfile11+stringYesUser agent profile.

ISendShortMessageCallback

Provides 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.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
isLastPartbooleanNoWhether 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.
resultSendSmsResultYesSMS message sending result.
urlstringYesURI for storing the sent SMS message.

IDeliveryShortMessageCallback

Provides the callback for the SMS message delivery report.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
pduArray<number>YesSMS message delivery report.

SendSmsResult

Enumerates SMS message sending results.

System capability: SystemCapability.Telephony.SmsMms

NameValueDescription
SEND_SMS_SUCCESS0The SMS message is sent successfully.
SEND_SMS_FAILURE_UNKNOWN1Failed to send the SMS message due to an unknown reason.
SEND_SMS_FAILURE_RADIO_OFF2Failed to send the SMS message because the modem is shut down.
SEND_SMS_FAILURE_SERVICE_UNAVAILABLE3Failed to send the SMS message because the network is unavailable or SMS message sending or receiving is not supported.

MmsInformation8+

Defines the MMS message information.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
messageTypeMessageTypeYesMessage type.
mmsTypeMmsSendReq |MmsSendConf |MmsNotificationInd |MmsRespInd |MmsRetrieveConf|MmsAcknowledgeInd|MmsDeliveryInd|MmsReadOrigInd|MmsReadRecIndYesPDU header type.
attachmentArray<MmsAttachment>NoAttachment.

MmsSendReq8+

Defines an MMS message sending request.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
fromMmsAddressYesMMS message source.
transactionIdstringYesTransaction ID.
contentTypestringYesContent type.
versionMmsVersionTypeYesVersion.
toArray<MmsAddress>NoDestination address.
datenumberNoDate.
ccArray<MmsAddress>NoCarbon copy.
bccArray<MmsAddress>NoBlind carbon copy.
subjectstringNoSubject.
messageClassnumberNoMessage class.
expirynumberNoExpiration.
priorityMmsPriorityTypeNoPriority.
senderVisibilitynumberNoSender visibility.
deliveryReportnumberNoDelivery report.
readReportnumberNoRead report.

MmsSendConf8+

Defines the MMS message sending configuration.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
responseStatenumberYesResponse status.
transactionIdstringYesTransaction ID.
versionMmsVersionTypeYesVersion.
messageIdstringNoMessage ID.

MmsNotificationInd8+

Defines an MMS notification index.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
transactionIdstringYesTransaction ID.
messageClassnumberYesMessage class.
messageSizenumberYesMessage size.
expirynumberYesExpiration.
contentLocationstringYesContent location.
versionMmsVersionTypeYesVersion.
fromMmsAddressNoSource address.
subjectstringNoSubject.
deliveryReportnumberNoStatus report.
contentClassnumberNoContent class.

MmsAcknowledgeInd8+

Defines an MMS confirmation index.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
transactionIdstringYesTransaction ID.
versionMmsVersionTypeYesVersion.
reportAllowedReportTypeNoReport allowed.

MmsRetrieveConf8+

Defines the MMS message retrieval configuration.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
transactionIdstringYesTransaction ID.
messageIdstringYesMessage ID.
datenumberYesDate.
contentTypestringYesContent type.
toArray<MmsAddress>YesDestination address.
versionMmsVersionTypeYesVersion.
fromMmsAddressNoSource address.
ccArray<MmsAddress>NoCarbon copy.
subjectstringNoSubject.
priorityMmsPriorityTypeNoPriority.
deliveryReportnumberNoStatus report.
readReportnumberNoRead report.
retrieveStatusnumberNoRetrieval status.
retrieveTextstringNoRetrieval text.

MmsReadOrigInd8+

Defines the original MMS message reading index.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
versionMmsVersionTypeYesVersion.
messageIdstringYesMessage ID.
toArray<MmsAddress>YesDestination address.
fromMmsAddressYesSource address.
datenumberYesDate.
readStatusnumberYesRead status.

MmsReadRecInd8+

Defines the MMS message reading index.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
versionMmsVersionTypeYesVersion.
messageIdstringYesMessage ID.
toArray<MmsAddress>YesDestination address.
fromMmsAddressYesSource address.
readStatusnumberYesRead status.
datenumberNoDate.

MmsAttachment8+

Defines the attachment of an MMS message.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
contentIdstringYesContent ID.
contentLocationstringYesContent location.
contentDispositionDispositionTypeYesContent disposition.
contentTransferEncodingstringYesEncoding for content transfer.
contentTypestringYesContent type.
isSmilbooleanYesWhether the synchronized multimedia integration language is used.
pathstringNoPath.
inBuffArray<number>NoWhether the message is in the buffer.
fileNamestringNoFile name.
charsetMmsCharSetsNoCharacter set.

MmsAddress8+

Defines an MMSC address.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
addressstringYesNetwork address.
charsetMmsCharSetsYesCharacter set.

MessageType8+

Message type.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameValueDescription
TYPE_MMS_SEND_REQ128MMS message sending request.
TYPE_MMS_SEND_CONF129MMS message sending configuration.
TYPE_MMS_NOTIFICATION_IND130MMS notification index.
TYPE_MMS_RESP_IND131MMS message response index.
TYPE_MMS_RETRIEVE_CONF132MMS message retrieval configuration.
TYPE_MMS_ACKNOWLEDGE_IND133MMS message acknowledgement index.
TYPE_MMS_DELIVERY_IND134MMS message delivery index.
TYPE_MMS_READ_REC_IND135MMS message reading and receiving index.
TYPE_MMS_READ_ORIG_IND136Original MMS message reading index.

MmsPriorityType8+

Enumerates MMS message priorities.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameValueDescription
MMS_LOW128Low priority.
MMS_NORMAL129Normal priority.
MMS_HIGH130High priority.

MmsVersionType8+

Enumerates MMS versions.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameValueDescription
MMS_VERSION_1_00x10MMS version 1_0.
MMS_VERSION_1_10x11MMS version 1_1.
MMS_VERSION_1_20x12MMS version 1_2.
MMS_VERSION_1_30x13MMS version 1_3.

MmsCharSets8+

Enumerates MMS character sets.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameValueDescription
BIG50X07EABIG5 format.
ISO_10646_UCS_20X03E8ISO_10646_UCS_2 format.
ISO_8859_10X04ISO_8859_1 format.
ISO_8859_20X05ISO_8859_2 format.
ISO_8859_30X06ISO_8859_3 format.
ISO_8859_40X07ISO_8859_4 format.
ISO_8859_50X08ISO_8859_5 format.
ISO_8859_60X09ISO_8859_6 format.
ISO_8859_70X0AISO_8859_7 format.
ISO_8859_80X0BISO_8859_8 format.
ISO_8859_90X0CISO_8859_9 format.
SHIFT_JIS0X11SHIFT_JIS format.
US_ASCII0X03US_ASCII format.
UTF_80X6AUTF_8 format.

DispositionType8+

Enumerates disposition types.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameValueDescription
FROM_DATA0Data source.
ATTACHMENT1Attachment.
INLINE2Inlining.

ReportType8+

Enumerates report types.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameValueDescription
MMS_YES128YES
MMS_NO129NO

CBConfigOptions7+

Defines the cell broadcast configuration options.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
enablebooleanYesWhether to enable cell broadcast.
startMessageIdnumberYesStart message ID.
endMessageIdnumberYesEnd message ID.
ranTypeRanTypeYesRAN type.

SimMessageStatus7+

Defines the SIM message status.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameValueDescription
SIM_MESSAGE_STATUS_FREE0Free state.
SIM_MESSAGE_STATUS_READ1Read state.
SIM_MESSAGE_STATUS_UNREAD3Unread state.
SIM_MESSAGE_STATUS_SENT5Storage of sent messages (applicable only to SMS).
SIM_MESSAGE_STATUS_UNSENT7Storage of unsent messages (applicable only to SMS).

RanType7+

RAN type.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameValueDescription
TYPE_GSM1GSM
TYPE_CDMA2CMDA

SmsEncodingScheme8+

Enumerates SMS encoding schemes.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameValueDescription
SMS_ENCODING_UNKNOWN0Unknown code.
SMS_ENCODING_7BIT17-digit code.
SMS_ENCODING_8BIT28-digit code.
SMS_ENCODING_16BIT316-digit code.

SimMessageOptions7+

Defines the SIM message options.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
smscstringYesShort message service center.
pdustringYesProtocol data unit.
statusSimMessageStatusYesStatus.

UpdateSimMessageOptions7+

Defines the updating SIM message options.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
slotIdnumberYesCard slot ID.
msgIndexnumberYesMessage index.
newStatusSimMessageStatusYesNew status.
pdustringYesProtocol data unit.
smscstringYesShort message service center.

SimShortMessage7+

Defines a SIM message.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
shortMessageShortMessageYesSMS message.
simMessageStatusSimMessageStatusYesSIM message status.
indexOnSimnumberYesSIM card index.

MmsDeliveryInd8+

Defines an MMS message delivery index.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
messageIdstringYesMessage ID.
datenumberYesDate.
toArray<MmsAddress>YesDestination address.
statusnumberYesStatus.
versionMmsVersionTypeYesVersion.

MmsRespInd8+

Defines an MMS response index.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
transactionIdstringYesEvent ID.
statusnumberYesStatus.
versionMmsVersionTypeYesVersion.
reportAllowedReportTypeNoReport allowed.

SmsSegmentsInfo8+

Defines the SMS message segment information.

System API: This is a system API.

System capability: SystemCapability.Telephony.SmsMms

NameTypeMandatoryDescription
splitCountnumberYesSplit count.
encodeCountnumberYesEncoding count.
encodeCountRemainingnumberYesRemaining encoding count.
schemeSmsEncodingSchemeYesEncoding scheme.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙APIs

harmony 鸿蒙System Common Events (To Be Deprecated Soon)

harmony 鸿蒙System Common Events

harmony 鸿蒙API Reference Document Description

harmony 鸿蒙Enterprise Device Management Overview (for System Applications Only)

harmony 鸿蒙BundleStatusCallback

harmony 鸿蒙@ohos.bundle.innerBundleManager (innerBundleManager)

harmony 鸿蒙@ohos.distributedBundle (Distributed Bundle Management)

harmony 鸿蒙@ohos.bundle (Bundle)

harmony 鸿蒙@ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/c0d343f9244a452eb99b5653d2911034