1# 电话服务子系统JS API变更 2 3OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,电话服务子系统的API变更如下: 4 5## 接口变更 6 7| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | 8|---|---|---|---| 9| ohos.telephony.sms | sms | hasSmsCapability(): boolean; | 新增 | 10| ohos.telephony.sim | CardType | SINGLE_MODE_ISIM_CARD = 60 | 新增 | 11| ohos.telephony.sim | CardType | DUAL_MODE_UG_CARD = 50 | 新增 | 12| ohos.telephony.sim | CardType | DUAL_MODE_TELECOM_LTE_CARD = 43 | 新增 | 13| ohos.telephony.sim | CardType | CU_DUAL_MODE_CARD = 42 | 新增 | 14| ohos.telephony.sim | CardType | CT_NATIONAL_ROAMING_CARD = 41 | 新增 | 15| ohos.telephony.sim | CardType | DUAL_MODE_CG_CARD = 40 | 新增 | 16| ohos.telephony.sim | CardType | SINGLE_MODE_RUIM_CARD = 30 | 新增 | 17| ohos.telephony.sim | CardType | SINGLE_MODE_USIM_CARD = 20 | 新增 | 18| ohos.telephony.sim | CardType | SINGLE_MODE_SIM_CARD = 10 | 新增 | 19| ohos.telephony.sim | CardType | UNKNOWN_CARD = -1 | 新增 | 20| ohos.telephony.sim | sim | hasSimCard(slotId: number, callback: AsyncCallback\<boolean>): void;<br>hasSimCard(slotId: number): Promise\<boolean>; | 新增 | 21| ohos.telephony.sim | sim | getMaxSimCount(): number; | 新增 | 22| ohos.telephony.sim | sim | getCardType(slotId: number, callback: AsyncCallback\<CardType>): void;<br>getCardType(slotId: number): Promise\<CardType>; | 新增 | 23| ohos.telephony.sim | sim | hasOperatorPrivileges(slotId: number, callback: AsyncCallback\<boolean>): void;<br>hasOperatorPrivileges(slotId: number): Promise\<boolean>; | 新增 | 24| ohos.telephony.sim | sim | isSimActive(slotId: number, callback: AsyncCallback\<boolean>): void;<br>isSimActive(slotId: number): Promise\<boolean>; | 新增 | 25| ohos.telephony.radio | NetworkState | cfgTech: RadioTechnology; | 新增 | 26| ohos.telephony.radio | radio | getOperatorName(slotId: number, callback: AsyncCallback\<string>): void;<br>getOperatorName(slotId: number): Promise\<string>; | 新增 | 27| ohos.telephony.radio | radio | isNrSupported(): boolean;<br>isNrSupported(slotId: number): boolean; | 新增 | 28| ohos.telephony.radio | radio | getPrimarySlotId(callback: AsyncCallback\<number>): void;<br>getPrimarySlotId(): Promise\<number>; | 新增 | 29| ohos.telephony.observer | LockReason | SIM_SIM_PUK | 新增 | 30| ohos.telephony.observer | LockReason | SIM_SIM_PIN | 新增 | 31| ohos.telephony.observer | LockReason | SIM_PC_PUK | 新增 | 32| ohos.telephony.observer | LockReason | SIM_PC_PIN | 新增 | 33| ohos.telephony.observer | LockReason | SIM_PP_PUK | 新增 | 34| ohos.telephony.observer | LockReason | SIM_PP_PIN | 新增 | 35| ohos.telephony.observer | LockReason | SIM_PU_PUK | 新增 | 36| ohos.telephony.observer | LockReason | SIM_PU_PIN | 新增 | 37| ohos.telephony.observer | LockReason | SIM_PN_PUK | 新增 | 38| ohos.telephony.observer | LockReason | SIM_PN_PIN | 新增 | 39| ohos.telephony.observer | LockReason | SIM_PUK | 新增 | 40| ohos.telephony.observer | LockReason | SIM_PIN | 新增 | 41| ohos.telephony.observer | LockReason | SIM_NONE | 新增 | 42| ohos.telephony.observer | SimStateData | reason: LockReason; | 新增 | 43| ohos.telephony.observer | SimStateData | state: SimState; | 新增 | 44| ohos.telephony.observer | SimStateData | type: CardType; | 新增 | 45| ohos.telephony.observer | observer | off(type: 'simStateChange', callback?: Callback\<SimStateData>): void; | 新增 | 46| ohos.telephony.observer | observer | on(type: 'simStateChange', callback: Callback\<SimStateData>): void;<br>on(type: 'simStateChange', options: { slotId: number }, callback: Callback\<SimStateData>): void; | 新增 | 47| ohos.telephony.observer | observer | off(type: 'cellularDataFlowChange', callback?: Callback\<DataFlowType>): void; | 新增 | 48| ohos.telephony.observer | observer | on(type: 'cellularDataFlowChange', callback: Callback\<DataFlowType>): void;<br>on(type: 'cellularDataFlowChange', options: { slotId: number },callback: Callback\<DataFlowType>): void; | 新增 | 49| ohos.telephony.observer | observer | off(type: 'cellularDataConnectionStateChange',callback?: Callback\<{ state: DataConnectState, network: RatType }>): void; | 新增 | 50| ohos.telephony.observer | observer | on(type: 'cellularDataConnectionStateChange', callback: Callback\<{ state: DataConnectState, network: RatType }>): void;<br>on(type: 'cellularDataConnectionStateChange', options: { slotId: number }, callback: Callback\<{ state: DataConnectState, network: RatType }>): void; | 新增 | 51| ohos.telephony.data | DataConnectState | DATA_STATE_SUSPENDED = 3 | 新增 | 52| ohos.telephony.data | DataConnectState | DATA_STATE_CONNECTED = 2 | 新增 | 53| ohos.telephony.data | DataConnectState | DATA_STATE_CONNECTING = 1 | 新增 | 54| ohos.telephony.data | DataConnectState | DATA_STATE_DISCONNECTED = 0 | 新增 | 55| ohos.telephony.data | DataConnectState | DATA_STATE_UNKNOWN = -1 | 新增 | 56| ohos.telephony.data | DataFlowType | DATA_FLOW_TYPE_DORMANT = 4 | 新增 | 57| ohos.telephony.data | DataFlowType | DATA_FLOW_TYPE_UP_DOWN = 3 | 新增 | 58| ohos.telephony.data | DataFlowType | DATA_FLOW_TYPE_UP = 2 | 新增 | 59| ohos.telephony.data | DataFlowType | DATA_FLOW_TYPE_DOWN = 1 | 新增 | 60| ohos.telephony.data | DataFlowType | DATA_FLOW_TYPE_NONE = 0 | 新增 | 61| ohos.telephony.data | data | isCellularDataRoamingEnabled(slotId: number, callback: AsyncCallback\<boolean>): void;<br>isCellularDataRoamingEnabled(slotId: number): Promise\<boolean>; | 新增 | 62| ohos.telephony.data | data | isCellularDataEnabled(callback: AsyncCallback\<boolean>): void;<br>isCellularDataEnabled(): Promise\<boolean>; | 新增 | 63| ohos.telephony.data | data | getCellularDataState(callback: AsyncCallback\<DataConnectState>): void;<br>getCellularDataState(): Promise\<DataConnectState>; | 新增 | 64| ohos.telephony.data | data | getCellularDataFlowType(callback: AsyncCallback\<DataFlowType>): void;<br>getCellularDataFlowType(): Promise\<DataFlowType>; | 新增 | 65| ohos.telephony.data | data | getDefaultCellularDataSlotId(callback: AsyncCallback\<number>): void;<br>getDefaultCellularDataSlotId(): Promise\<number>; | 新增 | 66| ohos.telephony.call | call | hasVoiceCapability(): boolean; | 新增 | 67| ohos.telephony.call | call | makeCall(phoneNumber: string, callback: AsyncCallback\<void>): void;<br>makeCall(phoneNumber: string): Promise\<void>; | 新增 | 68| ohos.contact | Website | website: string | 新增 | 69| ohos.contact | SipAddress | labelId: number | 新增 | 70| ohos.contact | SipAddress | sipAddress: string | 新增 | 71| ohos.contact | SipAddress | labelName: string | 新增 | 72| ohos.contact | SipAddress | static readonly INVALID_LABEL_ID: -1 | 新增 | 73| ohos.contact | SipAddress | static readonly SIP_OTHER: 3 | 新增 | 74| ohos.contact | SipAddress | static readonly SIP_WORK: 2 | 新增 | 75| ohos.contact | SipAddress | static readonly SIP_HOME: 1 | 新增 | 76| ohos.contact | SipAddress | static readonly CUSTOM_LABEL: 0 | 新增 | 77| ohos.contact | Relation | labelId: number | 新增 | 78| ohos.contact | Relation | relationName: string | 新增 | 79| ohos.contact | Relation | labelName: string | 新增 | 80| ohos.contact | Relation | static readonly INVALID_LABEL_ID: -1 | 新增 | 81| ohos.contact | Relation | static readonly RELATION_SPOUSE: 14 | 新增 | 82| ohos.contact | Relation | static readonly RELATION_SISTER: 13 | 新增 | 83| ohos.contact | Relation | static readonly RELATION_RELATIVE: 12 | 新增 | 84| ohos.contact | Relation | static readonly RELATION_REFERRED_BY: 11 | 新增 | 85| ohos.contact | Relation | static readonly RELATION_PARTNER: 10 | 新增 | 86| ohos.contact | Relation | static readonly RELATION_PARENT: 9 | 新增 | 87| ohos.contact | Relation | static readonly RELATION_MOTHER: 8 | 新增 | 88| ohos.contact | Relation | static readonly RELATION_MANAGER: 7 | 新增 | 89| ohos.contact | Relation | static readonly RELATION_FRIEND: 6 | 新增 | 90| ohos.contact | Relation | static readonly RELATION_FATHER: 5 | 新增 | 91| ohos.contact | Relation | static readonly RELATION_DOMESTIC_PARTNER: 4 | 新增 | 92| ohos.contact | Relation | static readonly RELATION_CHILD: 3 | 新增 | 93| ohos.contact | Relation | static readonly RELATION_BROTHER: 2 | 新增 | 94| ohos.contact | Relation | static readonly RELATION_ASSISTANT: 1 | 新增 | 95| ohos.contact | Relation | static readonly CUSTOM_LABEL: 0 | 新增 | 96| ohos.contact | PostalAddress | labelId: number | 新增 | 97| ohos.contact | PostalAddress | street: string | 新增 | 98| ohos.contact | PostalAddress | region: string | 新增 | 99| ohos.contact | PostalAddress | postcode: string | 新增 | 100| ohos.contact | PostalAddress | postalAddress: string | 新增 | 101| ohos.contact | PostalAddress | pobox: string | 新增 | 102| ohos.contact | PostalAddress | neighborhood: string | 新增 | 103| ohos.contact | PostalAddress | labelName: string | 新增 | 104| ohos.contact | PostalAddress | country: string | 新增 | 105| ohos.contact | PostalAddress | city: string | 新增 | 106| ohos.contact | PostalAddress | static readonly INVALID_LABEL_ID: -1 | 新增 | 107| ohos.contact | PostalAddress | static readonly ADDR_OTHER: 3 | 新增 | 108| ohos.contact | PostalAddress | static readonly ADDR_WORK: 2 | 新增 | 109| ohos.contact | PostalAddress | static readonly ADDR_HOME: 1 | 新增 | 110| ohos.contact | PostalAddress | static readonly CUSTOM_LABEL: 0 | 新增 | 111| ohos.contact | Portrait | uri: string | 新增 | 112| ohos.contact | PhoneNumber | labelId: number | 新增 | 113| ohos.contact | PhoneNumber | phoneNumber: string | 新增 | 114| ohos.contact | PhoneNumber | labelName: string | 新增 | 115| ohos.contact | PhoneNumber | static readonly INVALID_LABEL_ID: -1 | 新增 | 116| ohos.contact | PhoneNumber | static readonly NUM_MMS: 20 | 新增 | 117| ohos.contact | PhoneNumber | static readonly NUM_ASSISTANT: 19 | 新增 | 118| ohos.contact | PhoneNumber | static readonly NUM_WORK_PAGER: 18 | 新增 | 119| ohos.contact | PhoneNumber | static readonly NUM_WORK_MOBILE: 17 | 新增 | 120| ohos.contact | PhoneNumber | static readonly NUM_TTY_TDD: 16 | 新增 | 121| ohos.contact | PhoneNumber | static readonly NUM_TELEX: 15 | 新增 | 122| ohos.contact | PhoneNumber | static readonly NUM_RADIO: 14 | 新增 | 123| ohos.contact | PhoneNumber | static readonly NUM_OTHER_FAX: 13 | 新增 | 124| ohos.contact | PhoneNumber | static readonly NUM_MAIN: 12 | 新增 | 125| ohos.contact | PhoneNumber | static readonly NUM_ISDN: 11 | 新增 | 126| ohos.contact | PhoneNumber | static readonly NUM_COMPANY_MAIN: 10 | 新增 | 127| ohos.contact | PhoneNumber | static readonly NUM_CAR: 9 | 新增 | 128| ohos.contact | PhoneNumber | static readonly NUM_CALLBACK: 8 | 新增 | 129| ohos.contact | PhoneNumber | static readonly NUM_OTHER: 7 | 新增 | 130| ohos.contact | PhoneNumber | static readonly NUM_PAGER: 6 | 新增 | 131| ohos.contact | PhoneNumber | static readonly NUM_FAX_HOME: 5 | 新增 | 132| ohos.contact | PhoneNumber | static readonly NUM_FAX_WORK: 4 | 新增 | 133| ohos.contact | PhoneNumber | static readonly NUM_WORK: 3 | 新增 | 134| ohos.contact | PhoneNumber | static readonly NUM_MOBILE: 2 | 新增 | 135| ohos.contact | PhoneNumber | static readonly NUM_HOME: 1 | 新增 | 136| ohos.contact | PhoneNumber | static readonly CUSTOM_LABEL: 0 | 新增 | 137| ohos.contact | Organization | title: string | 新增 | 138| ohos.contact | Organization | name: string | 新增 | 139| ohos.contact | Note | noteContent: string | 新增 | 140| ohos.contact | NickName | nickName: string | 新增 | 141| ohos.contact | Name | nameSuffix: string | 新增 | 142| ohos.contact | Name | namePrefix: string | 新增 | 143| ohos.contact | Name | middleNamePhonetic: string | 新增 | 144| ohos.contact | Name | middleName: string | 新增 | 145| ohos.contact | Name | givenNamePhonetic: string | 新增 | 146| ohos.contact | Name | givenName: string | 新增 | 147| ohos.contact | Name | fullName: string | 新增 | 148| ohos.contact | Name | familyNamePhonetic: string | 新增 | 149| ohos.contact | Name | familyName: string | 新增 | 150| ohos.contact | ImAddress | labelId: number | 新增 | 151| ohos.contact | ImAddress | labelName: string | 新增 | 152| ohos.contact | ImAddress | imAddress: string | 新增 | 153| ohos.contact | ImAddress | static readonly INVALID_LABEL_ID: -2 | 新增 | 154| ohos.contact | ImAddress | static readonly IM_JABBER: 7 | 新增 | 155| ohos.contact | ImAddress | static readonly IM_ICQ: 6 | 新增 | 156| ohos.contact | ImAddress | static readonly IM_QQ: 4 | 新增 | 157| ohos.contact | ImAddress | static readonly IM_SKYPE: 3 | 新增 | 158| ohos.contact | ImAddress | static readonly IM_YAHOO: 2 | 新增 | 159| ohos.contact | ImAddress | static readonly IM_MSN: 1 | 新增 | 160| ohos.contact | ImAddress | static readonly IM_AIM: 0 | 新增 | 161| ohos.contact | ImAddress | static readonly CUSTOM_LABEL: -1 | 新增 | 162| ohos.contact | Holder | holderId: number | 新增 | 163| ohos.contact | Holder | readonly displayName: string | 新增 | 164| ohos.contact | Holder | readonly bundleName: string | 新增 | 165| ohos.contact | Group | title: string | 新增 | 166| ohos.contact | Group | groupId: number | 新增 | 167| ohos.contact | Event | labelId: number | 新增 | 168| ohos.contact | Event | labelName: string | 新增 | 169| ohos.contact | Event | eventDate: string | 新增 | 170| ohos.contact | Event | static readonly INVALID_LABEL_ID: -1 | 新增 | 171| ohos.contact | Event | static readonly EVENT_BIRTHDAY: 3 | 新增 | 172| ohos.contact | Event | static readonly EVENT_OTHER: 2 | 新增 | 173| ohos.contact | Event | static readonly EVENT_ANNIVERSARY: 1 | 新增 | 174| ohos.contact | Event | static readonly CUSTOM_LABEL: 0 | 新增 | 175| ohos.contact | Email | labelId: number | 新增 | 176| ohos.contact | Email | displayName: string | 新增 | 177| ohos.contact | Email | labelName: string | 新增 | 178| ohos.contact | Email | email: string | 新增 | 179| ohos.contact | Email | static readonly INVALID_LABEL_ID: -1 | 新增 | 180| ohos.contact | Email | static readonly EMAIL_OTHER: 3 | 新增 | 181| ohos.contact | Email | static readonly EMAIL_WORK: 2 | 新增 | 182| ohos.contact | Email | static readonly EMAIL_HOME: 1 | 新增 | 183| ohos.contact | Email | static readonly CUSTOM_LABEL: 0 | 新增 | 184| ohos.contact | Attribute | ATTR_WEBSITE | 新增 | 185| ohos.contact | Attribute | ATTR_SIP_ADDRESS | 新增 | 186| ohos.contact | Attribute | ATTR_RELATION | 新增 | 187| ohos.contact | Attribute | ATTR_POSTAL_ADDRESS | 新增 | 188| ohos.contact | Attribute | ATTR_PORTRAIT | 新增 | 189| ohos.contact | Attribute | ATTR_PHONE | 新增 | 190| ohos.contact | Attribute | ATTR_ORGANIZATION | 新增 | 191| ohos.contact | Attribute | ATTR_NOTE | 新增 | 192| ohos.contact | Attribute | ATTR_NICKNAME | 新增 | 193| ohos.contact | Attribute | ATTR_NAME | 新增 | 194| ohos.contact | Attribute | ATTR_IM | 新增 | 195| ohos.contact | Attribute | ATTR_GROUP_MEMBERSHIP | 新增 | 196| ohos.contact | Attribute | ATTR_EMAIL | 新增 | 197| ohos.contact | Attribute | ATTR_CONTACT_EVENT | 新增 | 198| ohos.contact | ContactAttributes | attributes: Attribute[] | 新增 | 199| ohos.contact | Contact | organization: Organization | 新增 | 200| ohos.contact | Contact | note: Note | 新增 | 201| ohos.contact | Contact | nickName: NickName | 新增 | 202| ohos.contact | Contact | name: Name | 新增 | 203| ohos.contact | Contact | websites: Website[] | 新增 | 204| ohos.contact | Contact | sipAddresses: SipAddress[] | 新增 | 205| ohos.contact | Contact | relations: Relation[] | 新增 | 206| ohos.contact | Contact | postalAddresses: PostalAddress[] | 新增 | 207| ohos.contact | Contact | portrait: Portrait | 新增 | 208| ohos.contact | Contact | phoneNumbers: PhoneNumber[] | 新增 | 209| ohos.contact | Contact | imAddresses: ImAddress[] | 新增 | 210| ohos.contact | Contact | groups: Group[] | 新增 | 211| ohos.contact | Contact | events: Event[] | 新增 | 212| ohos.contact | Contact | emails: Email[] | 新增 | 213| ohos.contact | Contact | contactAttributes: ContactAttributes | 新增 | 214| ohos.contact | Contact | readonly key: string | 新增 | 215| ohos.contact | Contact | readonly id: number | 新增 | 216| ohos.contact | Contact | static readonly INVALID_CONTACT_ID: -1 | 新增 | 217| ohos.contact | contact | isMyCard(id: number, callback: AsyncCallback\<boolean>): void;<br>isMyCard(id: number): Promise\<boolean>; | 新增 | 218| ohos.contact | contact | isLocalContact(id: number, callback: AsyncCallback\<boolean>): void;<br>isLocalContact(id: number): Promise\<boolean>; | 新增 | 219| ohos.contact | contact | updateContact(contact: Contact, callback: AsyncCallback\<void>): void;<br>updateContact(contact: Contact, attrs: ContactAttributes, callback: AsyncCallback\<void>): void;<br>updateContact(contact: Contact, attrs?: ContactAttributes): Promise\<void>; | 新增 | 220| ohos.contact | contact | queryMyCard(callback: AsyncCallback\<Contact>): void;<br>queryMyCard(attrs: ContactAttributes, callback: AsyncCallback\<Contact>): void;<br>queryMyCard(attrs?: ContactAttributes): Promise\<Contact>; | 新增 | 221| ohos.contact | contact | queryKey(id: number, callback: AsyncCallback\<string>): void;<br>queryKey(id: number, holder: Holder, callback: AsyncCallback\<string>): void;<br>queryKey(id: number, holder?: Holder): Promise\<string>; | 新增 | 222| ohos.contact | contact | queryHolders(callback: AsyncCallback\<Array\<Holder>>): void;<br>queryHolders(): Promise\<Array\<Holder>>; | 新增 | 223| ohos.contact | contact | queryGroups(callback: AsyncCallback\<Array\<Group>>): void;<br>queryGroups(holder: Holder, callback: AsyncCallback\<Array\<Group>>): void;<br>queryGroups(holder?: Holder): Promise\<Array\<Group>>; | 新增 | 224| ohos.contact | contact | queryContactsByPhoneNumber(phoneNumber: string, callback: AsyncCallback\<Array\<Contact>>): void;<br>queryContactsByPhoneNumber(phoneNumber: string, holder: Holder, callback: AsyncCallback\<Array\<Contact>>): void;<br>queryContactsByPhoneNumber(phoneNumber: string, attrs: ContactAttributes, callback: AsyncCallback\<Array\<Contact>>): void;<br>queryContactsByPhoneNumber(phoneNumber: string, holder: Holder, attrs: ContactAttributes, callback: AsyncCallback\<Array\<Contact>>): void;<br>queryContactsByPhoneNumber(phoneNumber: string, holder?: Holder, attrs?: ContactAttributes): Promise\<Array\<Contact>>; | 新增 | 225| ohos.contact | contact | queryContactsByEmail(email: string, callback: AsyncCallback\<Array\<Contact>>): void;<br>queryContactsByEmail(email: string, holder: Holder, callback: AsyncCallback\<Array\<Contact>>): void;<br>queryContactsByEmail(email: string, attrs: ContactAttributes, callback: AsyncCallback\<Array\<Contact>>): void;<br>queryContactsByEmail(email: string, holder: Holder, attrs: ContactAttributes, callback: AsyncCallback\<Array\<Contact>>): void;<br>queryContactsByEmail(email: string, holder?: Holder, attrs?: ContactAttributes): Promise\<Array\<Contact>>; | 新增 | 226| ohos.contact | contact | queryContacts(callback: AsyncCallback\<Array\<Contact>>): void;<br>queryContacts(holder: Holder, callback: AsyncCallback\<Array\<Contact>>): void;<br>queryContacts(attrs: ContactAttributes, callback: AsyncCallback\<Array\<Contact>>): void;<br>queryContacts(holder: Holder, attrs: ContactAttributes, callback: AsyncCallback\<Array\<Contact>>): void;<br>queryContacts(holder?: Holder, attrs?: ContactAttributes): Promise\<Array\<Contact>>; | 新增 | 227| ohos.contact | contact | queryContact(key: string, callback: AsyncCallback\<Contact>): void;<br>queryContact(key: string, holder: Holder, callback: AsyncCallback\<Contact>): void;<br>queryContact(key: string, attrs: ContactAttributes, callback: AsyncCallback\<Contact>): void;<br>queryContact(key: string, holder: Holder, attrs: ContactAttributes, callback: AsyncCallback\<Contact>): void;<br>queryContact(key: string, holder?: Holder, attrs?: ContactAttributes): Promise\<Contact>; | 新增 | 228| ohos.contact | contact | deleteContact(key: string, callback: AsyncCallback\<void>): void;<br>deleteContact(key: string): Promise\<void>; | 新增 | 229| ohos.contact | contact | selectContact(callback: AsyncCallback\<Array\<Contact>>): void;<br>selectContact(): Promise\<Array\<Contact>>; | 新增 | 230| ohos.contact | contact | addContact(contact: Contact, callback: AsyncCallback\<number>): void;<br>addContact(contact: Contact): Promise\<number>; | 新增 | 231