public abstract class

ConnectionLifecycleCallback

extends Object
java.lang.Object
   ↳ com.google.android.gms.nearby.connection.ConnectionLifecycleCallback

Class Overview

Listener for lifecycle events associated with a connection to a remote endpoint.

Summary

Public Constructors
ConnectionLifecycleCallback()
Public Methods
abstract void onConnectionInitiated(String endpointId, ConnectionInfo connectionInfo)
A basic encrypted channel has been created between you and the endpoint.
abstract void onConnectionResult(String endpointId, ConnectionResolution resolution)
Called after both sides have either accepted or rejected the connection.
abstract void onDisconnected(String endpointId)
Called when a remote endpoint is disconnected or has become unreachable.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ConnectionLifecycleCallback ()

Public Methods

public abstract void onConnectionInitiated (String endpointId, ConnectionInfo connectionInfo)

A basic encrypted channel has been created between you and the endpoint. Both sides are now asked if they wish to accept or reject the connection before any data can be sent over this channel.

This is your chance, before you accept the connection, to confirm that you connected to the correct device. Both devices are given an identical token; it's up to you to decide how to verify it before proceeding. Typically this involves showing the token on both devices and having the users manually compare and confirm; however, this is only required if you desire a secure connection between the devices.

Whichever route you decide to take (including not authenticating the other device), call acceptConnection(GoogleApiClient, String, PayloadCallback) when you're ready to talk, or rejectConnection(GoogleApiClient, String) to close the connection.

Parameters
endpointId String: The identifier for the remote endpoint.
connectionInfo ConnectionInfo: Other relevant information about the connection.

public abstract void onConnectionResult (String endpointId, ConnectionResolution resolution)

Called after both sides have either accepted or rejected the connection. If the ConnectionResolution's status is SUCCESS, both sides have accepted the connection and may now send Payloads to each other. Otherwise, the connection was rejected.

Parameters
endpointId String: The identifier for the remote endpoint.
resolution ConnectionResolution: The final result after tallying both devices' accept/reject responses.

public abstract void onDisconnected (String endpointId)

Called when a remote endpoint is disconnected or has become unreachable.

Parameters
endpointId String: The identifier for the remote endpoint that disconnected.