Updated on 2023-03-23 GMT+08:00

Uploading a Profile Picture

1
HWMBizSdk.getBizOpenApi().uploadSelfAvatar(String path, HwmCallback<Void> hwmCallback)

API Description

This API is used to upload a profile picture to the address book on the meeting server.

Precautions

1. Call this API only when you have logged in.

2. Upload a PNG or JPG image no more than 200 KB.

Method Definition
1
2
3
4
5
6
   /**
     * Uploads your profile picture to the address book on the meeting server.
     * @param path Indicates the local path of the profile picture.
     * @param hwmCallback Indicates the callback of the profile picture setting result.
     */
    void uploadSelfAvatar(String path, HwmCallback<Void> hwmCallback);

Parameter Description

Table 1 Parameter description

Parameter

Mandatory

Type

Description

path

Yes

String

Local path of the profile picture.

hwmCallback

Yes

HwmCallback<Void>

Callback object.

Return Values

None

Sample Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
HWMBizSdk.getBizOpenApi().uploadSelfAvatar(filepath, new HwmCallback<Void>() {
            @Override
            public void onSuccess(Void aVoid) {
                if (getActivity() != null) {
                    ((DemoActivity) getActivity()).dismissLoading();
                }
                DemoUtil.showToast("Profile picture set.");
            }

            @Override
            public void onFailed(int retCode, String desc) {
                if (getActivity() != null) {
                    ((DemoActivity) getActivity()).dismissLoading();
                }
                if (!TextUtils.isEmpty(desc)) {
                    DemoUtil.showToast(desc);
                } else {
                    DemoUtil.showToast("Failed to set the profile picture.");
                }
            }
        });