AudioBytes

public final class AudioBytes extends Object

A message that will be sent directly over near-ultrasound audio. The payload can be an arbitrary byte[] array limited in size as given by MAX_SIZE.

Use this in combination with the Messages API to send or receive data over audio. For instance, the toMessage() method can be used to fetch a Nearby Message object for a publish(GoogleApiClient, Message) call.

Similarly, the from(Message) method can be used to convert a Message obtained from a subscribe call to an AudioBytes object.

Constant Summary

int MAX_SIZE The maximum size of the audio message payload.

Public Constructor Summary

AudioBytes(byte[] audioData)
Creates an AudioBytes object from a byte[] payload for use with the Nearby Messages API.

Public Method Summary

static AudioBytes
from(Message message)
Converts a Message of type MESSAGE_TYPE_AUDIO_BYTES to an AudioBytes object.
byte[]
getBytes()
Returns the byte array payload.
Message
toMessage()
Obtain a Message object for use with the publish(GoogleApiClient, Message) call.
String

Inherited Method Summary

Constants

public static final int MAX_SIZE

The maximum size of the audio message payload. Only MAX_SIZE bytes will be sent over the audio medium.

Constant Value: 10

Public Constructors

public AudioBytes (byte[] audioData)

Creates an AudioBytes object from a byte[] payload for use with the Nearby Messages API.

Public Methods

public static AudioBytes from (Message message)

Converts a Message of type MESSAGE_TYPE_AUDIO_BYTES to an AudioBytes object.

Parameters
message Input Message object.
Returns

public byte[] getBytes ()

Returns the byte array payload.

public Message toMessage ()

Obtain a Message object for use with the publish(GoogleApiClient, Message) call.

Returns

public String toString ()