Nearby

  • Nearby is an API for communication with nearby devices.

  • Several fields related to Connections and Messages are deprecated and suggest using getConnectionsClient or getMessagesClient methods instead.

  • The getConnectionsClient method creates a new instance of ConnectionsClient.

  • The getFastPairClient method creates a new instance of FastPairClient.

  • MessagesClient methods are deprecated and recommend using ConnectionsClient instead, as Nearby Messages will be removed by the end of 2023.

  • UwbClient methods are available but direct use of the Nearby UWB SDK is not supported, recommending the Jetpack UWB SDK instead.

public final class Nearby extends Object

API for communication with nearby devices.

Field Summary

public static final Api<ConnectionsOptions> CONNECTIONS_API This field is deprecated. Use getConnectionsClient(Context) instead.
public static final Connections Connections This field is deprecated. Use getConnectionsClient(Context) instead.
public static final Api<MessagesOptions> MESSAGES_API This field is deprecated. Use getMessagesClient(Context) instead.
public static final Messages Messages This field is deprecated. Use getMessagesClient(Context) instead.

Public Method Summary

static ConnectionsClient
getConnectionsClient(Context context)
Creates a new instance of ConnectionsClient.
static ConnectionsClient
getConnectionsClient(Activity activity)
Creates a new instance of ConnectionsClient.
static FastPairClient
getFastPairClient(Context context)
Creates a new instance of FastPairClient.
static MessagesClient
getMessagesClient(Activity activity, MessagesOptions options)
This method is deprecated. Nearby Messages will be removed by the end of 2023. Use ConnectionsClient instead.
static MessagesClient
getMessagesClient(Activity activity)
This method is deprecated. Nearby Messages will be removed by the end of 2023. Use ConnectionsClient instead.
static MessagesClient
getMessagesClient(Context context, MessagesOptions options)
This method is deprecated. Nearby Messages will be removed by the end of 2023. Use ConnectionsClient instead.
static MessagesClient
getMessagesClient(Context context)
This method is deprecated. Nearby Messages will be removed by the end of 2023. Use ConnectionsClient instead.
static UwbClient
getUwbControleeClient(Context context)
Creates a new instance of controlee-type UwbClient.
static UwbClient
getUwbControllerClient(Context context)
Creates a new instance of controller-type UwbClient.

Inherited Method Summary

Fields

public static final Api<ConnectionsOptions> CONNECTIONS_API

This field is deprecated.
Use getConnectionsClient(Context) instead.

public static final Connections Connections

This field is deprecated.
Use getConnectionsClient(Context) instead.

public static final Api<MessagesOptions> MESSAGES_API

This field is deprecated.
Use getMessagesClient(Context) instead.

public static final Messages Messages

This field is deprecated.
Use getMessagesClient(Context) instead.

Public Methods

public static ConnectionsClient getConnectionsClient (Context context)

Creates a new instance of ConnectionsClient. Resolvable connections errors will create a system notification that the user can tap in order to resolve the error.

public static ConnectionsClient getConnectionsClient (Activity activity)

Creates a new instance of ConnectionsClient. The given Activity will be used to automatically prompt for resolution of resolvable connection errors.

public static FastPairClient getFastPairClient (Context context)

Creates a new instance of FastPairClient. Resolvable connections errors will create a system notification that the user can tap in order to resolve the error.

public static MessagesClient getMessagesClient (Activity activity, MessagesOptions options)

This method is deprecated.
Nearby Messages will be removed by the end of 2023. Use ConnectionsClient instead.

Creates a new instance of MessagesClient. The given Activity will be used to automatically prompt for resolution of resolvable connection errors.

public static MessagesClient getMessagesClient (Activity activity)

This method is deprecated.
Nearby Messages will be removed by the end of 2023. Use ConnectionsClient instead.

Creates a new instance of MessagesClient. The given Activity will be used to automatically prompt for resolution of resolvable connection errors.

public static MessagesClient getMessagesClient (Context context, MessagesOptions options)

This method is deprecated.
Nearby Messages will be removed by the end of 2023. Use ConnectionsClient instead.

Creates a new instance of MessagesClient. Resolvable connections errors will create a system notification that the user can tap in order to resolve the error.

public static MessagesClient getMessagesClient (Context context)

This method is deprecated.
Nearby Messages will be removed by the end of 2023. Use ConnectionsClient instead.

Creates a new instance of MessagesClient. Resolvable connections errors will create a system notification that the user can tap in order to resolve the error.

public static UwbClient getUwbControleeClient (Context context)

Creates a new instance of controlee-type UwbClient.

public static UwbClient getUwbControllerClient (Context context)

Creates a new instance of controller-type UwbClient.