Contacts

Sets contacts listener

Set the contact listener, and the result is returned through the data stream contactEveStm, which is returned as a ContactListenBean object.

_blePlugin.contactEveStm.listen(
        (ContactListenBean event) {
            /// Do something with new state,for example:
          setState(() {
            switch (event.type) {
              case ContactListenType.savedSuccess:
                _savedSuccess = event.savedSuccess!;
                break;
              case ContactListenType.savedFail:
                _savedFail = event.savedFail!;
                break;
              default:
                break;
            }
          });
        });

Callback Description(event):

ContactListenBean:

callback valuecallback value typecallback value description
typeintGet the corresponding return value according to type, where type is the value corresponding to ContactListenType.
savedSuccessintThe return value of the success of saving the contact;
savedFailintThe return value of the failure to save the contact

ContactListenType:

typevaluevalue description
savedSuccess1Set contacts successfully
savedFail2Failed to set contacts

Sets contacts with avatar listener

Sets the contact avatar listener, and the result is returned through the data stream contactAvatarEveStm, which is returned as a FileTransBean object.

_blePlugin.contactAvatarEveStm.listen(
        (FileTransBean event) {
            /// Do something with new state,for example:
          setState(() {
            switch (event.type) {
              case TransType.transStart:
                break;
              case TransType.transChanged:
                _progress = event.progress!;
                break;
              case TransType.transCompleted:
                break;
              case TransType.error:
                _error = event.error!;
                break;
              default:
                break;
            }
          });
        });

Callback Description(event):

FileTransBean:

callback valuecallback value typecallback value description
typeintGet the corresponding return value according to type, where type is the value corresponding to TransType.
progressintset progress
errorinterror code

TransType:

typevaluevalue description
transStart1Set a contact avatar to get started
transChanged2Set contact avatar progress changes
transCompleted3Set contact avatar successfully
error4Error setting contact avatar

Check support contacts

ContactConfigBean info = await _blePlugin.checkSupportQuickContact;

Callback Description:

ContactConfigBean:

valuevalue typevalue description
supportedboolWhether symbols are supported, such as ”+“
countintMaximum number of contacts
widthintThe width of the contact avatar
heightintThe height of contact avatar

Gets current contacts count

int contactCount = _blePlugin.queryContactCount;

Sets contact information

Sets the contact, the result is obtained through contactEveStm.

_blePlugin.sendContact(ContactBean info);

Parameter Description :

ContactBean:

valuevalue typevalue description
idintThe contact id
widthintThe contact avatar width
heightintThe contact avatar height
addressintThe contact address
nameStringThe contact name
numberStringThe contact phone number
avatarUint8List?The contact avatar

Precautions:

  • The Uint8List? type is a picture type, interacts with the backend, and converts it to a bitmap type at the backend.
  • Contacts sent to the watch face, must have an avatar.
  • id has size limit. The maximum value of id can be viewed through count in the return value of _blePlugin.checkSupportQuickContact, and cannot be greater than or equal to the queried value.

Sets contact avatar information

Sets the contact avatar , the result is obtained through contactAvatarEveStm.

_blePlugin.sendContactAvatar(ContactBean info);

Delete contacts information

Delete contact information based on contact id.

_blePlugin.deleteContact(int id);

Delete contacts avatar information

Delete contact avatar information based on contact id.

_blePlugin.deleteContactAvatar(int id);

clear contacts information

_blePlugin.clearContact();
Last Updated: