Public Member Function | Method Signature |
---|---|
ChannelState | getState |
void | addChannelStateListener(ChannelStateListener listener) |
void | removeChannelStateListener(ChannelStateListener listener) |
Public Member Function | Method Signature |
---|---|
void | send(Message message, HMR.Completion completion) |
void | addMessageListener(Identifiable target, MessageListener listener) |
void | removeMessageListener(Identifiable target, MessageListener listener) |
public static State getState()
Get the SDK current status. See details in HMR.State.
SDK current status
public static void init(@NonNull final Context appContext, final long appId)
Initialize Hummer
Notes:
- Unless otherwise specified, all API functions of Hummer are asynchronously called, and the API is called in the same thread.
Parameter | Description |
---|---|
appContext | Context |
appId | It is used to identify specific services, and should be artificially applied for from Hummer service providers. |
public static void open(final long uid,
@NonNull final String region,
@Nullable final Set<String> tags,
@NonNull final String token,
@Nullable final HMR.Completion completion)
Logging in an SDK, and starting to monitor server messages and pull corresponding message data.
Parameter | Description |
---|---|
uid | User ID |
region | Parameters of a region where a server is should be connected. Consult related SDK developers for details. |
tags | Field reserved, can be left empty temporarily. |
token | A user token is required for service initialization |
completion | Callback of processing after completion |
public static void close(@Nullable final Completion completion)
Log out an SDK
Notes:
- SDK logout is an asynchronous operation.
- Errors should be processed in completion callback.
Parameter | Description |
---|---|
completion | Callback of processing after completion |
public static void refreshToken(@NonNull final String token)
Refresh a user token
Parameter | Description |
---|---|
token | A user token to be refreshed |
public static void addStateListener(@NonNull final StateListener listener)
Add an SDK state change listener
Parameter | Description |
---|---|
listener | A listener to be added. See details in StateListener. |
public static void removeStateListener(@NonNull final StateListener listener)
Remove an SDK state change listener
Parameter | Description |
---|---|
listener | A listener to be removed. See details in StateListener. |
public static void addTokenInvalidListener(@NonNull final TokenInvalidListener listener)
Add a token invalid listener
Parameter | Description |
---|---|
listener | A listener to be added. See details in TokenInvalidListener. |
public static void removeTokenInvalidListener(@NonNull final TokenInvalidListener listener)
Remove a token invalid listener
Parameter | Description |
---|---|
listener | A listener to be removed. See details in TokenInvalidListener. |
public static String getVersion()
Get SDK version information
public static <Service> Service getService(@NonNull Class<Service> serviceClass)
Get a service instance
Service instance
public enum State { }
SDK current status
Enumeration Value | Description |
---|---|
Unavailable | An unavailable status. The SDK is in this status while being not initialized. |
Opening | Opening |
Opened | Opened |
Closing | Closing |
Closed | Closed |
public ChannelState getState()
Get a current connection status. See details in ChannelStateService.ChannelState.
Current connection status of SDK
public void addChannelStateListener(@NonNull ChannelStateListener listener)
Add a connection state change listener
Parameter | Description |
---|---|
listener | A listener to be added. See details in ChannelStateListener. |
public void removeChannelStateListener(@NonNull ChannelStateListener listener)
Remove a connection state change listener
Parameter | Description |
---|---|
listener | A listener to be removed. See details in ChannelStateListener. |
void createChatRoom(@NonNull ChatRoomInfo chatRoomInfo,
@NonNull HMR.CompletionArg<ChatRoom> completion);
Create a chatroom
Notes:
- The chatroom must be created before it can be used, so you need to create a corresponding chatroom API.
- After a chatroom is created, the server will return a corresponding chatroom ID used for identifying the chatroom in the future.
- Chatroom information such as name, description, bulletin, and extension information, should be provided during chatroom creation.
Parameter | Description |
---|---|
chatRoomInfo | Chatroom information objects include name, description, bulletin and extension information. See details in ChatRoomInfo. |
completion | One CompletionArg object - Calling succeeded: A local user receives callback onSuccess. - Calling failed: A local user receives callback onFailed. See Code for error codes. |
void dismissChatRoom(@NonNull ChatRoom chatRoom,
@Nullable HMR.Completion completion);
Close a chatroom
Notes:
- During destruction, you should provide the chatroom's ID so the server can correctly identify and destroy the desired chatroom.
- Destruction requires Owner permission.
- A single user’s call frequency limit is 10 times per 5 seconds.
Parameter | Description |
---|---|
chatRoom | Chatroom ID |
completion | One Completion object - Calling succeeded: A local user receives callback onSuccess. - Calling failed: A local user receives callback onFailed. See Code for error codes. |
void join(@NonNull ChatRoom chatRoom,
@NonNull Map<String, String> joinProps,
@NonNull Challenges.JoiningCompletion completion);
Join a chatroom
Notes:
You must join a chatroom before you can properly perform operations for that chatroom—for example, sending and receiving public screen or signaling messages.
Joining a chatroom follows a logic of “multi-user mutual removal”. For details, consult the background configuration.
A single user’s chatroom joining frequency is limited to 10 times per 5 seconds.
Parameter | Description |
---|---|
chatRoom | Chatroom ID |
joinProps | An extension field for service extension. The SDK is only responsible for pass-through. |
completion | One JoiningCompletion object - Calling succeeded: A local user receives callback onSucceed. - Calling failed: A local user receives callback onFailure. See Code for error codes. |
void leave(@NonNull ChatRoom chatRoom, @Nullable HMR.Completion completion);
Exit a chatroom
Notes:
- Once all the necessary logistics for joining the chatroom are processed, you can end interactions with the chatroom by exiting it. Listening to public screen or signaling messages and corresponding callback notifications will also be terminated.
Parameter | Description |
---|---|
chatRoom | Chatroom ID |
completion | One Completion object - Calling succeeded: A local user receives callback onSuccess. - Calling failed: A local user receives callback onFailed. See Code for error codes. |
void kick(@NonNull ChatRoom chatRoom,
@NonNull User member,
@Nullable Map<EKickInfo, String> extraInfo,
@NonNull HMR.Completion completion);
Remove chatroom users
Notes:
Only certain roles (Admin and Owner) can remove chatroom members. Though Admin roles cannot remove other Admin and Owner roles, Owner roles can remove any members in the channel.
Also, removed members and members to be removed can have to be removed from within the channel.
After successful chatroom member removal, the SDK background does not restrict that member from re-joining; however, the SDK will pass-through to the business server, which can then determine whether to allow re-joining.
A single user’s call frequency limit is 10 times per 5 seconds.
Parameter | Description |
---|---|
chatRoom | Chatroom ID |
member | Removed chatroom member |
extraInfo | SEI on removal. See EKickInfo for key values. Currently two Key values are supported: 1. Reason, Key bearing the reason for removal, for which only the character string corresponding to the Key’s removal reason needs to be filled into Value; 2. Time, Key bearing the duration of restriction, for which only a character string equal to the duration of restriction in seconds needs to be filled into Value. These are pass-through fields that do not need to be processed by the server. |
completion | One Completion object - Calling succeeded: A local user receives callback onSuccess. - Calling failed: A local user receives callback onFailed. See Code for error codes. |
void addRole(@NonNull ChatRoom chatRoom,
@NonNull User member,
@NonNull String role,
@NonNull HMR.Completion completion);
Calling failed: A local user receives callback onFailed.
Notes:
- Owner roles in the chatroom can add Admin roles to common users, but Admin roles cannot.
- A single user’s call frequency limit is 10 times per 5 seconds.
Parameter | Description |
---|---|
chatRoom | Chatroom ID |
member | A single user’s call frequency limit is 10 times per 5 seconds. |
role | Role type. Currently, only Admin can be filled in. See details in ChatRoomService.Roles. |
completion | One Completion object - Calling succeeded: A local user receives callback onSuccess. - Calling failed: A local user receives callback onFailed. See Code for error codes. |
void removeRole(@NonNull ChatRoom chatRoom,
@NonNull User member,
@NonNull String role,
@NonNull HMR.Completion completion);
Remove a chatroom permission role
Notes:
- Only a chatroom Owner can remove Admin roles; AdminRole cannot remove the AdminRole role.
- A single user’s call frequency limit is 10 times per 5 seconds.
Parameter | Description |
---|---|
chatRoom | Chatroom ID |
member | Chatroom member of removed role |
role | Role type. Currently, only Admin can be filled in. See details in ChatRoomService.Roles. |
completion | One Completion object - Calling succeeded: A local user receives callback onSuccess. - Calling failed: A local user receives callback onFailed. See Code for error codes. |
void fetchMembers(@NonNull ChatRoom chatRoom,
int num,
int offset,
@NonNull HMR.CompletionArg<List<User>> completion);
Get a chatroom member list
Notes:
- In some scenarios, a single chatroom may have many thousands of members; therefore, this SDK provides corresponding paged member lists according to your requirements. Meanwhile, a corresponding member list is sorted according to certain default rules.
- You can use the API for retrieving the member list even without joining the chatroom.
- A single user’s call frequency limit is 10 times per 5 seconds.
Parameter | Description |
---|---|
chatRoom | Chatroom ID |
num | Set the number of members returned on each page (recommended no more than 200) |
offset | Specific page (the first page starts from 0) |
completion | One CompletionArg object - Calling succeeded: A local user receives callback onSuccess. - Calling failed: A local user receives callback onFailed. See Code for error codes. |
void fetchRoleMembers(@NonNull ChatRoom chatRoom,
boolean online,
@NonNull HMR.CompletionArg<Map<String, List<User>>> completion);
Get a role-added member list for chatroom
Notes:
You can get corresponding role lists as needed; the service can display different UI interfaces according to the role lists as well as grant permissions for it.
You can obtain a role list before joining the chatroom.
A single user’s call frequency limit is 10 times per 5 seconds.
Parameter | Description |
---|---|
chatRoom | Chatroom ID |
online | Whether to only get online users: true: only get list of online members with roles added false:get list of all role-added members |
completion | One Completion object - Calling succeeded: A local user receives callback onSuccess. - Calling failed: A local user receives callback onFailed.. See Code for error codes. |
void fetchBasicInfo(@NonNull ChatRoom chatRoom,
@NonNull HMR.CompletionArg<ChatRoomInfo> completion);
Get chatroom’s basic profile information
Notes:
- Getting chatroom information includes chatroom name, description, and bulletin, as well as corresponding extended field information.
- You can obtain chatroom information without joining the chatroom.
- A single user’s call frequency limit is 10 times per 5 seconds.
Parameter | Description |
---|---|
chatRoom | Chatroom ID |
completion | One CompletionArg object - Calling succeeded: A local user receives callback onSuccess. - Calling failed: A local user receives callback onFailed. See Code for error codes. |
void changeBasicInfo(@NonNull ChatRoom chatRoom,
@NonNull Map<ChatRoomInfo.BasicInfoType, String> propInfo,
@NonNull HMR.Completion completion);
Change chatroom’s basic profile information
Notes:
- You can change chatroom information for one or more chatrooms according to your needs. Only the key-value pairs to be modified need to be specified in the s.
- An Admin or Owner role is required to change chatroom information.
- A single user’s call frequency limit is 10 times per 5 seconds.
Parameter | Description |
---|---|
chatRoom | Chatroom ID |
propInfo | A modified profile value. See ChatRoomInfo.BasicInfoType for key enumeration values. |
completion | One Completion object - Calling succeeded: A local user receives callback onSuccess. - Calling failed: A local user receives callback onFailed. See Code for error codes. |
void muteMember(@NonNull ChatRoom chatRoom,
@NonNull User member,
@Nullable String reason,
@NonNull HMR.Completion completion);
Mute chatroom members
Notes:
- This service can mute a specific member according to your requirement. The default muting time is three days, after which the member will automatically be unmuted.
- Only an Admin or Owner can enable mute. While an Admin can only mute regular members, an Owner can mute any channel member (including Admin).
- Members to be muted have to already be in the chatroom.
- A single user’s call frequency limit is 10 times per 5 seconds.
Parameter | Description |
---|---|
chatRoom | Chatrooms that a member is in |
member | A member to be muted |
reason | Reason for muting |
completion | One Completion object - Calling succeeded: A local user receives callback onSuccess. - Calling failed: A local user receives callback onFailed. See Code for error codes. |
void unmuteMember(@NonNull ChatRoom chatRoom,
@NonNull User member,
@Nullable String reason,
@NonNull HMR.Completion completion);
Unmute chatroom member
Notes:
- Members to be unmuted have to already be in the chatroom.
- Only an Admin or Owner role can unmute. An Owner can unmute all channel members (Admin included), whereas Admin can only unmute common members.
- A single user’s call frequency limit is 10 times per 5 seconds.
Parameter | Description |
---|---|
chatRoom | Chatrooms that a member is in |
member | A member to be unmuted |
reason | Reason for unmuting |
completion | One Completion object - Calling succeeded: A local user receives callback onSuccess. - Calling failed: A local user receives callback onFailed. See [Code]( for error codes. |
void fetchMutedUsers(@NonNull ChatRoom chatRoom,
@NonNull HMR.CompletionArg<Set<User>> completion);
Get a chatroom mute list
Notes:
- Some users on the mute list might not be in the chatroom.
- A single user’s call frequency limit is 10 times per 5 seconds.
Parameter | Description |
---|---|
chatRoom | A chatroom requiring a mute list |
completion | One CompletionArg object - Calling succeeded: A local user receives callback onSuccess. - Calling failed: A local user receives callback onFailed.onFailed. See Code for error codes. |
void isMuted(@NonNull ChatRoom chatRoom,
@NonNull User member,
@NonNull HMR.CompletionArg<Boolean> completion);
Determine whether a certain user is on a chatroom’s mute list.
Notes:
- A single user’s call frequency is limited to 10 times every 5 seconds.
Parameter | Description |
---|---|
chatRoom | Chatroom requiring judgment |
member | User requiring judgment |
completion | One CompletionArg object - User requiring judgment - Calling failed: A local user receives callback onFailed. See Code for error codes. |
void setUserInfo(@NonNull final ChatRoom chatRoom,
@NonNull final Map<String, String> infoMap,
@Nullable final HMR.Completion completion);
Set own user information
Notes:
- Maximum capacity:
set user profiles, the maximum number of supported attributes: 32
Maximum value for a single user profile: 8K.- A single user’s call frequency limit is 10 times per 5 seconds.
Parameter | Description |
---|---|
chatRoom | Chatrooms that a member is in |
infoMap | User information to be set |
completion | One CompletionArg object - Calling succeeded: A local user receives callback onSuccess. - Calling failed: A local user receives callback onFailed. See Code for error codes. |
void fetchOnlineUserInfoList(@NonNull ChatRoom chatRoom,
@NonNull HMR.CompletionArg<Map<User, Map<String, String>>> completion);
Get a chatroom user information list
Notes:
- A maximum of 100 member lists can be returned; if over 100 lists are called for, 100 random lists are returned.
Parameter | Description |
---|---|
chatRoom | A chatroom to be searched |
completionHandler | One CompletionArg object - Calling succeeded: A local user receives callback onSuccess. - Calling failed: A local user receives callback onFailed. See Code for error codes. |
void addListener(@NonNull final ChatRoomListener listener);
Add a chatroom callback listener
Parameter | Description |
---|---|
listener | A listener object. See details in ChatRoomListener. |
void removeListener(@NonNull final ChatRoomListener listener);
Remove a chatroom callback listener
Parameter | Description |
---|---|
listener | A listener object. See details in ChatRoomListener. |
void addMemberListener(@NonNull final MemberListener listener);
Add a chatroom member callback listener
Parameter | Description |
---|---|
listener | A listener object. See details in MemberListenerr. |
void removeMemberListener(@NonNull final MemberListener listener);
Remove a chatroom member callback listener
Parameter | Description |
---|---|
listener | A listener object. See details in MemberListenerr. |
void send(@NonNull Message message, @Nullable HMR.Completion completion);
A message sending API: supports sending a public screen (only supports text), unicast, or broadcast message. See details in Content.
**Notes
- This service can compose a message body by itself, filling in corresponding content and sending it out.
- This API also can resend the message in the case that the message sending fails.
- A single user’s call frequency limit:
For sending public screen messages: 10 times/5s
For sending a custom unicast message: 50 times/5s
For sending a custom broadcast message: 50 times/5s- Maximum capacity:
For a single unicast message: 2K
For a single broadcast message: 2K
Parameter | Description |
---|---|
message | Message instance |
completion | Callback of sending operation completion |
There may be multiple stages/statuses in a message sending process, but The completion
only conducts final completion callback. Obtain the corresponding callback with MessageListener.
void addMessageListener(@Nullable Identifiable target, @NonNull MessageListener listener);
Add a message sending/receiving listener.
Parameter | Description |
---|---|
target | A message object to be subject to sending/receiving listening |
listener | A listener object to be added |
void removeMessageListener(@Nullable Identifiable target, @NonNull MessageListener listener);
Remove a message sending/receiving listener
Parameter | Description |
---|---|
target | A message object to be released from message sending/receiving listening |
listener | A listener object to be removed |
public interface Completion {
// Callback succeeded
void onSuccess();
// Callback failed
void onFailed(Error err);
}
Succeeded Calling Back the Result
public interface CompletionArg<Argument> {
// Callback succeeded,
void onSuccess(Argument arg);
// Callback failed
void onFailed(Error err);
}
enum ChannelState {
Unavailable,
Disconnected,
Connecting,
Connected,
}
Enumeration Value | Description |
---|---|
Unavailable | Channel is not initialized |
Disconnected | Channel is disconnected |
Connecting | Channel is connecting |
Connected | Channel is connected |
public final class ChatRoomInfo {
public enum BasicInfoType {
Name,
Description,
Bulletin,
AppExtra,
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public String getBulletin() {
return bulletin;
}
public String getAppExtra() {
return appExtra;
}
public ChatRoomInfo(@NonNull String name, @Nullable String description,
@Nullable String bulletin, @Nullable String appExtra) {
this.name = name;
this.description = description;
this.bulletin = bulletin;
this.appExtra = appExtra;
}
private final String name;
private final String description;
private final String bulletin;
private final String appExtra;
}
public enum BasicInfoType {
Name,
Description,
Bulletin,
AppExtra,
}
A basic chatroom information enumeration field: mainly used to modify and listen to chatroom information; it can identify which field is or needs to be changed.
Enumeration Value | Description |
---|---|
Name | Chatroom name |
Description | Chatroom description |
Bulletin | Chatroom announcement |
AppExtra | Chatroom extended field (1K at maximum) |
final class Signal extends Content {
public final User user;
public final String content;
public static Signal unicast(@NonNull User user, @NonNull String content) {
return new Signal(user, content);
}
public static Signal broadcast(@NonNull String content) {
return new Signal(null, content);
}
private Signal(User user, @NonNull String content) {
this.user = user;
this.content = content;
}
@Override
public String toString() {
return "ChatRoom.Signal{" + content + "}";
}
}
public interface JoiningCompletion {
void onSucceed();
void onFailure(@NonNull Error error);
// Reseveration
void onReceiveChallenge(Challenges.Password challenge);
// Reseveration
void onReceiveChallenge(Challenges.AppChallenge challenge);
}
enum EKickInfo {
Time,
Reason,
}
final class Roles {
// Administrator
public static final String Admin = "admin";
// Room owner
public static final String Owner = "owner";
}
public final class Message {
/**
* Build a null ChatMessage object
*/
public Message() {
}
/**
* Build a ChatMessage object that presets a message receiver and message content
*
* @param receiver Object for message receiving
* @param content Message content
*/
public Message(Identifiable receiver, Content content) {
this.chatContent = content;
this.receiver = receiver;
this.timestamp = 0L;
}
/**
* Stattus abstract concept of ChatMessage
*/
public interface State {
}
/**
* Get the message content
*/
public Content getContent() {
return this.chatContent;
}
/**
* Set the message content
*/
public void setContent(Content content) {
this.chatContent = content;
}
/**
* Message sender. Due to the chat message (Message), it must originate from user. Therefore, its type can only be User
* In case of user instance, rapidly judge whether this message is sent by the current user through HMR.isMe() when rendering the session interface.
*/
public Identifiable getSender() {
return sender;
}
/**
* Set the message sender. In case of the message sent out locally, it will be automatically covered as the local user (Me) when calling ChatService.send method
*
* @param sender Message sender
*/
public void setSender(Identifiable sender) {
this.sender = sender;
}
/**
* Message receiver. Specific type is multi-state,which may be Person (user chat session),Group (group chat session)……
*/
public Identifiable getReceiver() {
return receiver;
}
/**
* Set the message receiver. For the message sent locally, the service must display that ChatMessage displays and configure the Receiver attribute.
*
* @param receiver Message receiver
*/
public void setReceiver(Identifiable receiver) {
this.receiver = receiver;
}
/**
* For the current user, the method is used to return the target object corresponding to the chat.
*
* @return In caes of P2P message, return the user object beyond the current user. In case of group, chatroom, official number and other messages, return receiver as target
*/
public Identifiable getTarget() {
// For P2P chat messages, the logical table for determining target of conversation is as follows:
// 1. sender: me, receiver: me <- receiver
// 2. sender: me, receiver: fellow <- receiver
// 3. sender: fellow, receiver: me <- sender
// 4. sender: fellow, receiver: fellow <-N/A We should not have received this message
if (sender instanceof User && receiver instanceof User) {
if (HMR.isMe(sender)) {
return receiver;
} else if (HMR.isMe(receiver)) {
return sender;
} else {
return null;
}
}
// For non-P2P messages including group message, chatroom message, and public account message, receiver must be the relationship object itself
// sender is the person sending message to the relationship, therefore receiver can be returned directly
return receiver;
}
/**
* timestamp attribute is a message timstamp. When the message is sent (will be sent), the timestamp is the local timestamp of device; and when it is sent completely, the time stamp is Hummer server
* Returned timestamp. Considering the time difference between the local timestamp and server time, as well as the time difference between the servers in the server cluster, the timestamp
* can only be taken as the basis for approximately (in most cases) judging the message sequence.
*/
public long getTimestamp() {
return this.timestamp;
}
/**
* Set the message timestamp
*/
public void setTimestamp(long ts) {
this.timestamp = ts;
}
/**
* uuid is the (approximately) uniquely identified id of message, and as uuid is independently generated at the local client, the conflict may occur theoretically. But
* this probability is very low, so it can be used as the uniquely identified id of message to remove the repeated message.
*/
public String getUuid() {
return this.uuid;
}
/**
* Set the unique identifer of message, which is usually generated in Hummer and set. Generally, the service does not call this method
*/
public void setUuid(String id) {
this.uuid = id;
}
/**
* Each ChatMessage object can attach to a service expansion information. This information can help the service pass through user avatar and other data closely related to the service logic. Hummer only
* pass through this data, rather than specificially explaining and processing.
*/
public String getAppExtra() {
return appExtra;
}
/**
* Set the service pass-through data of message
*/
public void setAppExtra(String appExtra) {
this.appExtra = appExtra;
}
private String uuid;
private Identifiable sender;
private Identifiable receiver;
private PushContent pushContent;
private Long timestamp;
private String appExtra;
private Content chatContent;
}
Profile (value) | Note |
---|---|
uuid | Unique message ID |
sender | Message sender. See details in Identifiable. |
receiver | Message receiver. See detail in Identifiable. |
timestamp | Message timestamp |
appExtra | SEI. The service can analyze and perform special processing on this profile. |
chatContent | Message content: text, unicast and broadcast. See details in Content. |
Abstract class of unique identifiers
public abstract class Identifiable {
/**
* Both User and Chatroom must have the unique identifier, and getId is used to return such identifier.
* But, User and Chatroom may have the same id value.
* Therefore, it must keep in mind that, different message senders and receivers cannot be judged through the features of id value.
*/
public abstract long getId();
}
Implementation Class | Note |
---|---|
User | A unique identifiers class. See details in User. |
ChatRoom | A chatroom unique identifier class. See details in ChatRoom. |
A user object identifier for identifying Hummer system
public final class User extends Identifiable {
/**
* Build the user ID object
* @param uid User uid,For Hummer,when uid is 0, it indicates anonymous user
*/
public User(long uid) {
this.uid = uid;
}
/**
* Get user ID value
*/
@Override
public long getId() {
return uid;
}
private final long uid;
}
Chatroom unique identifier class
public final class ChatRoom extends Identifiable {
public ChatRoom(long id) {
this.roomId = id;
}
@Override
public long getId() {
return roomId;
}
private final long roomId;
}
Used to represent a chatroom content type, with the specific type implemented by sub-classes, such as Text and Signal.
public class Content {}
Inheritance Class | Note |
---|---|
Text | Text message content type. See details in Text. |
Signal | Chatroom signaling messages (includes unicast and broadcast). See details in ChatRoomService.Signal. |
Text message content type
public final class Text extends Content {
/**
* Build a text message
* @param text Text content of message
*/
public Text(String text) {
this.text = text;
}
/**
* Get the message text
*/
public String getText() {
return text;
}
private String text;
}
Hummer indicates general error types, common in requests that require network communication, such as sending or receiving messages. See Code for enumeration of Error.code.
public final class Error {
/**
* code attribute is mainly used for machine judgement, rapid log location and other functions
*/
public final int code;
/**
* reason attribute describes mCode through readable text form
*/
public final String desc;
/**
* Build Error instance,
*
* @param code Code of processed result
* @param desc Text description of processed result
*/
public Error(int code, String desc) {
this.code = code;
this.desc = desc;
}
}