public static final class

MessageFilter.Builder

extends Object
java.lang.Object
   ↳ com.google.android.gms.nearby.messages.MessageFilter.Builder

Class Overview

Builder for MessageFilter.

Summary

Public Constructors
MessageFilter.Builder()
Public Methods
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)
Includes raw audio byte messages.
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.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public MessageFilter.Builder ()

Public Methods

public MessageFilter build ()

Builds an instance of MessageFilter.

Returns
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.

Returns
MessageFilter.Builder

public MessageFilter.Builder includeAudioBytes (int numAudioBytes)

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_NAMESPACE_RESERVED, and type=MESSAGE_TYPE_AUDIO_BYTES. Use from(Message) to parse the message content.

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

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

Includes Eddystone UIDs.

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

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

public MessageFilter.Builder includeFilter (MessageFilter filter)

Includes the previously constructed filter.

Parameters
filter MessageFilter
Returns
MessageFilter.Builder

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

Includes iBeacon IDs.

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

Parameters
proximityUuid UUID: The proximity UUID.
major Short: An optional major value.
minor Short: An optional minor value.
Returns
MessageFilter.Builder

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 String: The namespace that the message belongs to. It must be non-empty and cannot contain the following invalid character: star(*).
type String: The type of the message to include. It must non-null and cannot contain the following invalid character: star(*).
Returns
MessageFilter.Builder
Throws
IllegalArgumentException if namespace or type is not valid.