| CLASS info |
| public class Message implements Parcelable |
| Represents the message that will be shared with nearby devices. The message consists of client-specified content and a type. The type can be used in MessageFilter.Builder to limit which messages an app can receive in a subscription. |
| Type | Name | Desc |
| int | MAX_CONTENT_SIZE | Maximum size of the message content, in bytes. |
| int | MAX_TYPE_LENGTH | Maximum size of a message type, in bytes. |
| String | MESSAGE_NAMESPACE_RESERVED | Namespace reserved for special messages. For details, please refer to MESSAGE_TYPE_*. |
| String | MESSAGE_TYPE_EDDYSTONE_UID | For details, please refer to includeEddystoneUids(String, String) and parse(Message). |
| String | MESSAGE_TYPE_IBEACON_ID | For details, please refer to includeIBeaconIds(UUID, Short, Short) and parse(Message). |
| Type | Name | Desc |
| public static final Creator<Message> | CREATOR |
| Constructor name |
| public Message(byte[] content) Creates a message with the specified content and the default type. Use this constructor when your app uses the default type to communicate with nearby devices. Parameters: content: message content. The size cannot exceed MAX_CONTENT_SIZE. |
| public Message(byte[] content, String type) Creates a message based on the given content and message type.Parameters: content: message content. The size cannot exceed MAX_CONTENT_SIZE. type: message type. The value cannot exceed MAX_TYPE_LENGTH. |
| Return | Method |
| boolean | equals(Object other) Checks whether any other object is the same as this object. |
| byte[] | getContent() Returns the message content. |
| String | getNamespace() Returns the non-empty string for a public namespace or an empty string for the private namespace. For example, a beacon attachment is a public namespace. |
| String | getType() Returns the message type. An empty string is returned if no type is specified when the message is created. |
| int | hashCode() Obtains the hash value. |
| String | toString() Converts an object into a readable character string. |
| void | writeToParcel(Parcel out, int flags) Writes this value into an out parcel. |
| Constant |
| public static final int MAX_CONTENT_SIZE |
| Maximum size of the message content, in bytes. Constant value: 64 |
| Constant |
| public static final int MAX_TYPE_LENGTH |
| Maximum size of a message type, in bytes. Constant value: 16 |
| Constant |
| public static final String MESSAGE_NAMESPACE_RESERVED |
| Namespace reserved for special messages. For details, please refer to MESSAGE_TYPE_*. Constant value: “_reserved_namespace” |
| Constant |
| public static final String MESSAGE_TYPE_EDDYSTONE_UID |
| For details, please refer to includeEddystoneUids(String, String) and parse(Message). Constant value: “_eddystone_uid” |
| Constant |
| public static final String MESSAGE_TYPE_IBEACON_ID |
| For details, please refer to includeIBeaconIds(String, String) and parse(Message). Constant value: “_ibeacon_id” |
| Constructor |
| public Message(byte[] content) |
| Creates a message with the specified content and the default type. |
Parameters
| Parameter name | Parameter desc |
| content | Message content. The size cannot exceed MAX_CONTENT_SIZE. |
| Constructor |
| public Message(byte[] content, String type) |
| Creates a message based on the given content and message type. |
Parameters
| Parameter name | Parameter desc |
| content | Message content. The size cannot exceed MAX_CONTENT_SIZE. |
| type | Message type. The value cannot exceed MAX_TYPE_LENGTH. |
| Method |
| public boolean equals(Object other) |
| Checks whether any other object is the same as this object. |
Parameters
| Parameter name | Parameter desc |
| other | Other object. |
| Method |
| public byte[] getContent() |
| Returns the message content. |
| Method |
| public String getNamespace() |
| Returns the non-empty string for a public namespace or an empty string for the private namespace. For example, a beacon attachment is a public namespace. |
| Method |
| public String getType() |
| Returns the message type. An empty string is returned if no type is specified when the message is created. |
| Method |
| public int hashCode() |
| Obtains the hash value. |
| Method |
| public String toString() |
| Converts an object into a readable character string. |
| Method |
| public void writeToParcel(Parcel out, int flags) |
| Writes this value into an out parcel. |
Parameters
| Parameter name | Parameter desc |
| out | Parcel to which this object is written. |
| flags | Writing mode. |