Connections.MessageListener | Android Developers

Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

Language
close

- - About
  - Wear
  - TV
  - Auto
- - Get Started
  - Devices
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
  - Google Services
  - Samples
- - Google Play
  - Essentials
  - Get Users
  - Engage & Retain
  - Monetize
  - Analyze
  - Tools & Reference
  - Developer Stories

## Results

Loading...
public static interface

# Connections.MessageListener

com.google.android.gms.nearby.connection.Connections.MessageListener

## Class Overview

Listener for messages from a remote endpoint.

## Summary

Public Methods
abstract void | onDisconnected(String remoteEndpointId) Called when a remote endpoint is disconnected / becomes unreachable.
abstract void | onMessageReceived(String remoteEndpointId, byte[] payload, boolean isReliable) Called when a message is received from a remote endpoint.

## Public Methods

#### public abstract void onDisconnected (String remoteEndpointId)

Called when a remote endpoint is disconnected / becomes unreachable.

##### Parameters

remoteEndpointId | The identifier for the remote endpoint that disconnected.

#### public abstract void onMessageReceived (String remoteEndpointId, byte[] payload, boolean isReliable)

Called when a message is received from a remote endpoint.

##### Parameters

remoteEndpointId | The identifier for the remote endpoint that sent the message.
payload | The bytes of the message sent by the remote endpoint. This array will not exceed `MAX_RELIABLE_MESSAGE_LEN` bytes for reliable messages, or `MAX_UNRELIABLE_MESSAGE_LEN` for unreliable ones.
isReliable | True if the message was sent reliably, false otherwise.