Browse SDKs · React Native
SDKsReact Native

Get your profile

Get the current user profile with the OpenIM React Native SDK.

Copy

Call getSelfUserInfo() to get the signed-in account's user information.

const currentUser = await OpenIMSDK.getSelfUserInfo();

Return result

The method returns the current account's SelfUserInfo:

FieldTypeDescription
userIDstringThe OpenIM user ID of the signed-in user.
nicknamestringAccount nickname.
faceURLstringAccount avatar URL.
createTimenumberTime when the user record was created.
globalRecvMsgOptMessageReceiveOptTypeThe account's global message reception option.
exstringAn account extension string defined by your business.

Call this method after initialization and login to display the current account's avatar, nickname, and global message reception setting. Clear the stored current-user information when switching accounts.