MessageFilter.Builder

public static final class MessageFilter.Builder extends Object

Builder for MessageFilter.

Public Constructor Summary

Public Method Summary

MessageFilter
build()
Builds an instance of MessageFilter.
MessageFilter.Builder
includeAllMyTypes()
Filters for all messages published by this application (and any other applications in the same Google Developers Console project), regardless of type.
MessageFilter.Builder
includeAudioBytes(int numAudioBytes)
This method is deprecated. Nearby Messages will no longer support audio.
MessageFilter.Builder
includeEddystoneUids(String hexNamespace, String hexInstance)
Includes Eddystone UIDs.
MessageFilter.Builder
includeFilter(MessageFilter filter)
Includes the previously constructed filter.
MessageFilter.Builder
includeIBeaconIds(UUID proximityUuid, Short major, Short minor)
Includes iBeacon IDs.
MessageFilter.Builder
includeNamespacedType(String namespace, String type)
Filters for all messages in the given namespace with the given type.

Inherited Method Summary

Public Constructors

public Builder ()

Public Methods

public MessageFilter build ()

Builds an instance of MessageFilter.

public MessageFilter.Builder includeAllMyTypes ()

Filters for all messages published by this application (and any other applications in the same Google Developers Console project), regardless of type.

public MessageFilter.Builder includeAudioBytes (int numAudioBytes)

This method is deprecated.
Nearby Messages will no longer support audio.

Includes raw audio byte messages. This can only be called once to set the number of audio bytes to be received.

Audio byte messages will have namespace=Message.MESSAGE_NAMESPACE_RESERVED, and type=Message.MESSAGE_TYPE_AUDIO_BYTES. Use AudioBytes.from(Message) to parse the message content.

Parameters
numAudioBytes Number of bytes for the audio bytes message (capped by AudioBytes.MAX_SIZE).
Throws
IllegalArgumentException if numAudioBytes is less than zero or greater than AudioBytes.MAX_SIZE.

public MessageFilter.Builder includeEddystoneUids (String hexNamespace, String hexInstance)

Includes Eddystone UIDs.

Eddystone UID messages will have namespace=Message.MESSAGE_NAMESPACE_RESERVED, and type=Message.MESSAGE_TYPE_EDDYSTONE_UID. Use EddystoneUid.from(Message) to parse the message content.

Parameters
hexNamespace The 10-byte Eddystone UID namespace in hex format. For example, "a032ffed0532bca3846d".
hexInstance An optional 6-byte Eddystone UID instance in hex format. For example, "00aabbcc2233".

public MessageFilter.Builder includeFilter (MessageFilter filter)

Includes the previously constructed filter.

public MessageFilter.Builder includeIBeaconIds (UUID proximityUuid, Short major, Short minor)

Includes iBeacon IDs.

iBeacon ID messages will have namespace=Message.MESSAGE_NAMESPACE_RESERVED, and type=Message.MESSAGE_TYPE_I_BEACON_ID. Use IBeaconId.from(Message) to parse the message content.

Parameters
proximityUuid The proximity UUID.
major An optional major value.
minor An optional minor value.

public MessageFilter.Builder includeNamespacedType (String namespace, String type)

Filters for all messages in the given namespace with the given type.

Namespaces are currently only settable for messages published via beacons.

Parameters
namespace The namespace that the message belongs to. It must be non-empty and cannot contain the following invalid character: star(*).
type The type of the message to include. It must non-null and cannot contain the following invalid character: star(*).
Throws
IllegalArgumentException if namespace or type is not valid.