public final class

AudioBytes

extends Object
java.lang.Object
   ↳ com.google.android.gms.nearby.messages.audio.AudioBytes

Class Overview

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.

Summary

Constants
int MAX_SIZE The maximum size of the audio message payload.
Public Constructors
AudioBytes(byte[] audioData)
Creates an AudioBytes object from a byte[] payload for use with the Nearby Messages API.
Public Methods
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 toString()
[Expand]
Inherited Methods
From class java.lang.Object

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 (0x0000000a)

Public Constructors

public AudioBytes (byte[] audioData)

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

Parameters
audioData byte

Public Methods

public static AudioBytes from (Message message)

Converts a Message of type MESSAGE_TYPE_AUDIO_BYTES to an AudioBytes object.

Parameters
message Message: Input Message object.
Returns
AudioBytes Instance of a corresponding AudioBytes object.

public byte[] getBytes ()

Returns the byte array payload.

Returns
byte[]

public Message toMessage ()

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

Returns
Message Message object.

public String toString ()

Returns
String