AI-generated Key Takeaways
-
This class is deprecated as Nearby Messages will no longer support audio.
-
AudioBytes represents a message sent over near-ultrasound audio with a byte array payload limited by MAX_SIZE.
-
The class provides methods to convert between AudioBytes and Nearby Messages for publishing and subscribing data over audio.
-
The maximum size of the audio message payload is defined by the constant MAX_SIZE, which is 10 bytes.
This class is deprecated.
Nearby Messages will no longer support audio.
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
Messages.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.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
Messages.publish(GoogleApiClient, Message) call.
|
| String |
toString()
|
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.
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.MESSAGE_TYPE_AUDIO_BYTES to an AudioBytes object.
Parameters
| message | Input Message
object. |
|---|
Returns
- Instance of a corresponding
AudioBytesobject.
public byte[] getBytes ()
Returns the byte array payload.
public Message toMessage ()
Obtain a Message
object for use with the
Messages.publish(GoogleApiClient, Message) call.
Returns
Messageobject.