UserContext
The UserContext class.
- Controlling the user's behavior of "going on and off stage".
- Updating user information and properties.
getLocalUserInfo
Gets the information of the local user.
abstract fun getLocalUserInfo(): AgoraEduContextUserInfo
Returns
If the method call succeeds, the SDK returns AgoraEduContextUserInfo.
getCoHostList
Gets the information of all users on the "stage".
abstract fun getCoHostList(): List<AgoraEduContextUserInfo>
Returns
If the method call succeeds, the SDK returns an array of AgoraEduContextUserInfo.
getUserList
Gets the user information of the specified role.
abstract fun getUserList(role: AgoraEduContextUserRole): List<AgoraEduContextUserInfo>
Parameter
- role
- The user role. See AgoraEduContextUserRole.
Returns
If the method call succeeds, the SDK returns an array of AgoraEduContextUserInfo.
getAllUserList
Gets the information of all users in the room.
abstract fun getAllUserList(): List<AgoraEduContextUserInfo>
Returns
If the method call succeeds, the SDK returns an array of AgoraEduContextUserInfo.
updateUserProperties
Adds or updates custom user properties.
abstract fun updateUserProperties(userUuid: String, properties: MutableMap<String, Any>, cause: MutableMap<String, Any>?, callback: EduContextCallback<Unit>? = null)
For details, see How can I set custom user properties?
After you successfully update the property, the SDK triggers onUserPropertiesUpdated.
Parameter
- userUuid
- The user ID.
- properties
- The user properties.
- cause
- The update reason, which can be empty.
- callback
- Get the method call result asynchronously through EduContextCallback.
deleteUserProperties
Deletes custom user properties.
abstract fun deleteUserProperties(userUuid: String, keys: MutableList<String>, cause: MutableMap<String, Any>?, callback: EduContextCallback<Unit>? = null)
Parameter
- userUuid
- The user ID.
- keys
- The key path of the property that you want to delete, such as "key1.subkey1".
- cause
- The reason for deletion, which can be empty.
- callback
- Get the method call result asynchronously through EduContextCallback.
getUserProperties
Gets the custom properties of the specified user.
abstract fun getUserProperties(userUuid: String): MutableMap<String, Any>
Parameter
- userUuid
- The user ID.
Returns
If the method call succeeds, the SDK returns the custom user properties.
getUserRewardCount
Gets the number of rewards owned by the specified user.
abstract fun getUserRewardCount(userUuid: String): Int
Parameter
- userUuid
- The user ID.
Returns
If the method call succeeds, the SDK returns the number of rewards.
getHandsWaveEnable
Checks whether the "raising a hand" feature is enabled.
abstract fun getHandsWaveEnable(): Boolean
Checks whether the students in the current room can "raise their hands" to apply for speaking on the "stage".
Returns
If the method call succeeds, the SDK returns the result.
handsWave
Raises the hand to apply for speaking on the "stage".
abstract fun handsWave(duration: Int, callback: EduContextCallback<Unit>? = null)
Parameter
- duration
- The duration of the application (seconds).
- payload
- Custom information, which can be empty.
- callback
- Get the method call result asynchronously through EduContextCallback.
handsDown
Puts down the hand.
abstract fun handsDown(callback: EduContextCallback<Unit>? = null)
Parameter
- callback
- Get the method call result asynchronously through EduContextCallback.