Uses Nearby Connections peer-to-peer networking API that allows apps to easily discover, connect to, and exchange data with nearby devices in real-time, regardless of network connectivity
npm install @capacitor-trancee/nearby-connections
npx cap sync
Nearby Connections needs access to both Bluetooth and the local network to advertise, discover, make connections, and transfer data. Provide a usage description for each resource needed, in your app’s Info.plist
. If you don’t, attempts to access the resource will fail, and might even cause your app to crash.
Required usage description keys:
NSBluetoothAlwaysUsageDescription
NSLocalNetworkUsageDescription
In addition to usage description keys, an NSBonjourServices
key with a list of the service types that will be browsed by the app, will also need to be added. The only service type that must be added can be generated by taking the first 12 bytes of the SHA-256
hash of your app's service ID.
Read about Configuring Info.plist
in the iOS Guide for more information on setting iOS permissions in Xcode
Before using Nearby Connections, your app must request the appropriate permissions. Add the following permissions to your AndroidManifest.xml
:
<!-- https://developers.google.com/nearby/connections/android/get-started#request_permissions -->
<!-- Required for Nearby Connections -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission
android:name="android.permission.BLUETOOTH"
android:maxSdkVersion="30" />
<uses-permission
android:name="android.permission.BLUETOOTH_ADMIN"
android:maxSdkVersion="30" />
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"
android:maxSdkVersion="32" />
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"
android:maxSdkVersion="32" />
<uses-permission
android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission
android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission
android:name="android.permission.BLUETOOTH_SCAN"
android:usesPermissionFlags="neverForLocation"
tools:targetApi="s" />
<uses-permission
android:name="android.permission.NEARBY_WIFI_DEVICES"
android:usesPermissionFlags="neverForLocation"
tools:targetApi="s" />
<!-- Optional: only required for FILE payloads -->
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />
<uses-feature
android:name="android.hardware.bluetooth_le"
android:required="false" />
If the user does not grant all required permissions, the Nearby Connections API will refuse to allow your app to start advertising or discovering.
Read about Setting Permissions in the Android Guide for more information on setting Android permissions.
This plugin will use the following project variables (defined in your app's variables.gradle
file):
-
playServicesNearbyVersion
version ofcom.google.android.gms:play-services-nearby
(default:19.3.0
) -
playServicesLocationVersion
version ofcom.google.android.gms:play-services-location
(default:21.3.0
) -
protoliteWellKnownTypesVersion
version ofcom.google.firebase:protolite-well-known-types
(default:18.0.0
)
These configuration values are available:
Prop | Type | Description | Since |
---|---|---|---|
endpointName |
string |
A human readable name for this endpoint, to appear on the remote device. | 1.0.0 |
serviceID |
ServiceID |
An identifier to advertise your app to other endpoints. The serviceID value must uniquely identify your app. As a best practice, use the package name of your app (for example, com.example.myapp ). |
1.0.0 |
strategy |
Strategy |
Sets the Strategy to be used when discovering or advertising to Nearby devices. |
1.0.0 |
connectionType |
ConnectionType |
Sets whether the client should disrupt the current connection to optimize the transfer or not. Only available on Android. | 1.0.0 |
lowPower |
boolean |
Sets whether low power should be used. Only available on Android. | 1.0.0 |
autoConnect |
boolean |
Automatically accept the connection on both sides. | 1.0.0 |
payload |
string |
What payload to send when automatically connecting to each other. | 1.0.0 |
In capacitor.config.json
:
{
"plugins": {
"NearbyConnections": {
"endpointName": "My App",
"serviceID": "com.example.myapp",
"strategy": Strategy.STAR,
"connectionType": ConnectionType.BALANCED,
"lowPower": true,
"autoConnect": true,
"payload": "Hello, World!"
}
}
}
In capacitor.config.ts
:
/// <reference types="@capacitor-trancee/nearby-connections" />
import { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
plugins: {
NearbyConnections: {
endpointName: "My App",
serviceID: "com.example.myapp",
strategy: Strategy.STAR,
connectionType: ConnectionType.BALANCED,
lowPower: true,
autoConnect: true,
payload: "Hello, World!",
},
},
};
export default config;
initialize(...)
reset()
startAdvertising(...)
stopAdvertising()
startDiscovery(...)
stopDiscovery()
requestConnection(...)
acceptConnection(...)
rejectConnection(...)
disconnect(...)
sendPayload(...)
cancelPayload(...)
status()
checkPermissions()
requestPermissions(...)
addListener('onPermissionChanged', ...)
addListener('onBluetoothStateChanged', ...)
addListener('onEndpointFound', ...)
addListener('onEndpointLost', ...)
addListener('onEndpointInitiated', ...)
addListener('onEndpointConnected', ...)
addListener('onEndpointRejected', ...)
addListener('onEndpointFailed', ...)
addListener('onEndpointDisconnected', ...)
addListener('onEndpointBandwidthChanged', ...)
addListener('onPayloadReceived', ...)
addListener('onPayloadTransferUpdate', ...)
- Interfaces
- Type Aliases
- Enums
initialize(options?: InitializeOptions | undefined) => Promise<void>
Initializes Nearby Connections for advertising and discovering of endpoints.
Param | Type |
---|---|
options |
InitializeOptions |
Since: 1.0.0
reset() => Promise<void>
Stops and resets advertising and discovering of endpoints.
Since: 1.0.0
startAdvertising(options?: StartAdvertisingOptions | undefined) => Promise<void>
Starts advertising the local endpoint.
Param | Type |
---|---|
options |
StartAdvertisingOptions |
Since: 1.0.0
stopAdvertising() => Promise<void>
Stops advertising the local endpoint.
Since: 1.0.0
startDiscovery(options?: StartDiscoveryOptions | undefined) => Promise<void>
Starts discovery for remote endpoints.
Param | Type |
---|---|
options |
StartDiscoveryOptions |
Since: 1.0.0
stopDiscovery() => Promise<void>
Stops discovery for remote endpoints.
Since: 1.0.0
requestConnection(options: RequestConnectionOptions) => Promise<void>
Sends a request to connect to a remote endpoint.
Param | Type |
---|---|
options |
RequestConnectionOptions |
Since: 1.0.0
acceptConnection(options: AcceptConnectionOptions) => Promise<void>
Accepts a connection to a remote endpoint.
Param | Type |
---|---|
options |
AcceptConnectionOptions |
Since: 1.0.0
rejectConnection(options: RejectConnectionOptions) => Promise<void>
Rejects a connection to a remote endpoint.
Param | Type |
---|---|
options |
RejectConnectionOptions |
Since: 1.0.0
disconnect(options: DisconnectOptions) => Promise<void>
Disconnects from a remote endpoint.
Payload
s can no longer be sent to or received from the endpoint after this method is called.
Param | Type |
---|---|
options |
DisconnectOptions |
sendPayload(options: SendPayloadOptions) => Promise<SendPayloadResult>
Sends a Payload
to a remote endpoint.
Param | Type |
---|---|
options |
SendPayloadOptions |
Returns: Promise<SendPayloadResult>
Since: 1.0.0
cancelPayload(options: CancelPayloadOptions) => Promise<void>
Cancels a Payload
currently in-flight to or from remote endpoint(s).
Param | Type |
---|---|
options |
CancelPayloadOptions |
Since: 1.0.0
status() => Promise<StatusResult>
Returns advertising and discovering status, and discovered endpoints.
Returns: Promise<StatusResult>
Since: 1.0.0
checkPermissions() => Promise<PermissionStatus>
Check for the appropriate permissions to use Nearby.
Returns: Promise<PermissionStatus>
Since: 1.0.0
requestPermissions(permissions?: NearbyConnectionsPermissions | undefined) => Promise<PermissionStatus>
Request the appropriate permissions to use Nearby.
Param | Type |
---|---|
permissions |
NearbyConnectionsPermissions |
Returns: Promise<PermissionStatus>
Since: 1.0.0
addListener(eventName: 'onPermissionChanged', listenerFunc: (granted: boolean) => void) => Promise<PluginListenerHandle>
Called when permission is granted or revoked for this app to use Nearby.
Param | Type |
---|---|
eventName |
'onPermissionChanged' |
listenerFunc |
(granted: boolean) => void |
Returns: Promise<PluginListenerHandle>
Since: 1.0.0
addListener(eventName: 'onBluetoothStateChanged', listenerFunc: (state: BluetoothState) => void) => Promise<PluginListenerHandle>
Called when state of Bluetooth has changed.
Param | Type |
---|---|
eventName |
'onBluetoothStateChanged' |
listenerFunc |
(state: BluetoothState) => void |
Returns: Promise<PluginListenerHandle>
Since: 1.0.0
addListener(eventName: 'onEndpointFound', listenerFunc: EndpointFoundCallback) => Promise<PluginListenerHandle>
Called when a remote endpoint is discovered.
Param | Type |
---|---|
eventName |
'onEndpointFound' |
listenerFunc |
EndpointFoundCallback |
Returns: Promise<PluginListenerHandle>
Since: 1.0.0
addListener(eventName: 'onEndpointLost', listenerFunc: EndpointLostCallback) => Promise<PluginListenerHandle>
Called when a remote endpoint is no longer discoverable.
Param | Type |
---|---|
eventName |
'onEndpointLost' |
listenerFunc |
EndpointLostCallback |
Returns: Promise<PluginListenerHandle>
Since: 1.0.0
addListener(eventName: 'onEndpointInitiated', listenerFunc: EndpointInitiatedCallback) => Promise<PluginListenerHandle>
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.
Param | Type |
---|---|
eventName |
'onEndpointInitiated' |
listenerFunc |
EndpointInitiatedCallback |
Returns: Promise<PluginListenerHandle>
Since: 1.0.0
addListener(eventName: 'onEndpointConnected', listenerFunc: EndpointConnectedCallback) => Promise<PluginListenerHandle>
Called after both sides have accepted the connection. Both sides may now send Payloads to each other.
Param | Type |
---|---|
eventName |
'onEndpointConnected' |
listenerFunc |
EndpointConnectedCallback |
Returns: Promise<PluginListenerHandle>
Since: 1.0.0
addListener(eventName: 'onEndpointRejected', listenerFunc: EndpointRejectedCallback) => Promise<PluginListenerHandle>
Called when either side rejected the connection. Payloads can not be exchaged.
Param | Type |
---|---|
eventName |
'onEndpointRejected' |
listenerFunc |
EndpointRejectedCallback |
Returns: Promise<PluginListenerHandle>
addListener(eventName: 'onEndpointFailed', listenerFunc: EndpointFailedCallback) => Promise<PluginListenerHandle>
Param | Type |
---|---|
eventName |
'onEndpointFailed' |
listenerFunc |
EndpointFailedCallback |
Returns: Promise<PluginListenerHandle>
addListener(eventName: 'onEndpointDisconnected', listenerFunc: EndpointDisconnectedCallback) => Promise<PluginListenerHandle>
Called when a remote endpoint is disconnected or has become unreachable.
Param | Type |
---|---|
eventName |
'onEndpointDisconnected' |
listenerFunc |
EndpointDisconnectedCallback |
Returns: Promise<PluginListenerHandle>
Since: 1.0.0
addListener(eventName: 'onEndpointBandwidthChanged', listenerFunc: EndpointBandwidthChangedCallback) => Promise<PluginListenerHandle>
Called when a connection is established or if the connection quality improves to a higher connection bandwidth.
Param | Type |
---|---|
eventName |
'onEndpointBandwidthChanged' |
listenerFunc |
EndpointBandwidthChangedCallback |
Returns: Promise<PluginListenerHandle>
Since: 1.0.0
addListener(eventName: 'onPayloadReceived', listenerFunc: PayloadReceivedCallback) => Promise<PluginListenerHandle>
Called when a Payload
is received from a remote endpoint.
Param | Type |
---|---|
eventName |
'onPayloadReceived' |
listenerFunc |
PayloadReceivedCallback |
Returns: Promise<PluginListenerHandle>
Since: 1.0.0
addListener(eventName: 'onPayloadTransferUpdate', listenerFunc: PayloadTransferUpdateCallback) => Promise<PluginListenerHandle>
Called with progress information about an active Payload
transfer, either incoming or outgoing.
Param | Type |
---|---|
eventName |
'onPayloadTransferUpdate' |
listenerFunc |
PayloadTransferUpdateCallback |
Returns: Promise<PluginListenerHandle>
Since: 1.0.0
Prop | Type | Description | Default | Since |
---|---|---|---|---|
endpointName |
string |
A human readable name for this endpoint, to appear on the remote device. | 1.0.0 | |
serviceID |
ServiceID |
An identifier to advertise your app to other endpoints. The serviceID value must uniquely identify your app. As a best practice, use the package name of your app (for example, com.example.myapp ). |
1.0.0 | |
strategy |
Strategy |
Sets the Strategy to be used when discovering or advertising to Nearby devices. |
1.0.0 | |
lowPower |
boolean |
Sets whether low power should be used. Only available on Android. | false |
1.0.0 |
autoConnect |
boolean |
Automatically accept the connection on both sides. | 1.0.0 | |
payload |
string |
What payload to send when automatically connecting to each other. | 1.0.0 |
Prop | Type | Description | Default | Since |
---|---|---|---|---|
endpointName |
string |
A human readable name for this endpoint, to appear on the remote device. | 1.0.0 | |
connectionType |
ConnectionType |
Sets whether the client should disrupt the current connection to optimize the transfer or not. Only available on Android. | ConnectionType.BALANCED |
1.0.0 |
lowPower |
boolean |
Sets whether low power should be used. Only available on Android. | false |
1.0.0 |
Prop | Type | Description | Default | Since |
---|---|---|---|---|
lowPower |
boolean |
Sets whether low power should be used. Only available on Android. | false |
1.0.0 |
Prop | Type | Description | Since |
---|---|---|---|
endpointID |
EndpointID |
The identifier for the remote endpoint to which a connection request will be sent. | 1.0.0 |
endpointName |
string |
A human readable name for this endpoint, to appear on the remote device. | 1.0.0 |
Prop | Type | Description | Since |
---|---|---|---|
endpointID |
EndpointID |
The identifier for the remote endpoint. | 1.0.0 |
Prop | Type | Description | Since |
---|---|---|---|
endpointID |
EndpointID |
The identifier for the remote endpoint. | 1.0.0 |
Prop | Type | Description | Since |
---|---|---|---|
endpointID |
EndpointID |
The identifier for the remote endpoint to disconnect from. | 1.0.0 |
Prop | Type | Description | Since |
---|---|---|---|
payloadID |
PayloadID |
A unique identifier for this payload. | 1.0.0 |
payloadType |
PayloadType |
The type of this payload. | 1.0.0 |
status |
PayloadTransferUpdateStatus |
The status of the payload. | 1.0.0 |
Prop | Type | Description | Since |
---|---|---|---|
endpointID |
EndpointID |
The identifier for the remote endpoint to which the payload should be sent. | 1.0.0 |
endpointIDs |
string[] |
The identifiers for the remote endpoints to which the payload should be sent. | 1.0.0 |
payload |
string |
The Payload to be sent. |
1.0.0 |
Prop | Type | Description | Since |
---|---|---|---|
payloadID |
PayloadID |
The identifier for the Payload to be canceled. | 1.0.0 |
Prop | Type |
---|---|
isAdvertising |
boolean |
isDiscovering |
boolean |
Prop | Type | Description | Since |
---|---|---|---|
wifiNearby |
PermissionState |
NEARBY_WIFI_DEVICES Required to be able to advertise and connect to nearby devices via Wi-Fi. |
1.0.0 |
wifiState |
PermissionState |
ACCESS_WIFI_STATE Allows applications to access information about Wi-Fi networks. CHANGE_WIFI_STATE Allows applications to change Wi-Fi connectivity state. |
1.0.0 |
bluetoothNearby |
PermissionState |
BLUETOOTH_ADVERTISE Required to be able to advertise to nearby Bluetooth devices. BLUETOOTH_CONNECT Required to be able to connect to paired Bluetooth devices. BLUETOOTH_SCAN Required to be able to discover and pair nearby Bluetooth devices. |
1.0.0 |
bluetoothLegacy |
PermissionState |
BLUETOOTH Allows applications to connect to paired bluetooth devices. BLUETOOTH_ADMIN Allows applications to discover and pair bluetooth devices. |
1.0.0 |
location |
PermissionState |
ACCESS_FINE_LOCATION Allows an app to access precise location. |
1.0.0 |
locationCoarse |
PermissionState |
ACCESS_COARSE_LOCATION Allows an app to access approximate location. |
1.0.0 |
Prop | Type |
---|---|
permissions |
NearbyConnectionPermissionType[] |
Prop | Type |
---|---|
remove |
() => Promise<void> |
Prop | Type | Description | Since |
---|---|---|---|
endpointID |
EndpointID |
The ID of the remote endpoint that was discovered. | 1.0.0 |
endpointName |
string |
A human readable name for this endpoint, to appear on the remote device. | 1.0.0 |
Information about a connection that is being initiated.
Prop | Type | Description | Since |
---|---|---|---|
authenticationToken |
string |
A 4 digit authentication token that has been given to both devices. | 1.0.0 |
authenticationStatus |
number |
An authentication status for Authentication handshaking result after uKey2 verification. | 1.0.0 |
isIncomingConnection |
boolean |
True if the connection request was initiated from a remote device. False if this device was the one to try and initiate the connection. |
1.0.0 |
Information about a connection's bandwidth.
Prop | Type | Description | Since |
---|---|---|---|
quality |
Quality |
The connection's current quality. | 1.0.0 |
A Payload sent between devices.
Prop | Type | Description | Since |
---|---|---|---|
payloadID |
PayloadID |
A unique identifier for this payload. | 1.0.0 |
payloadType |
PayloadType |
The type of this payload. | 1.0.0 |
payload |
string |
Payload data. | 1.0.0 |
Describes the status for an active Payload
transfer, either incoming or outgoing.
Prop | Type | Description | Since |
---|---|---|---|
payloadID |
PayloadID |
The payload identifier. | 1.0.0 |
status |
PayloadTransferUpdateStatus |
The status of the payload. | 1.0.0 |
bytesTransferred |
number |
The number of bytes transferred so far. | 1.0.0 |
totalBytes |
number |
The total number of bytes in the payload. | 1.0.0 |
Used to represent a service identifier.
string
Used to represent an endpoint.
string
Used to represent a payload.
number
'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'
'wifiNearby' | 'wifiState' | 'bluetoothNearby' | 'bluetoothLegacy' | 'location' | 'locationCoarse'
Called when a remote endpoint is discovered.
(_: Endpoint): void
Called when a remote endpoint is no longer discoverable.
(_: Endpoint): void
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.
(_: Endpoint & ConnectionInfo): void
Called after both sides have accepted the connection. Both sides may now send Payloads to each other.
(_: Endpoint): void
Called when either side rejected the connection. Payloads can not be exchaged.
(_: Endpoint): void
Called when a remote endpoint is disconnected or has become unreachable. At this point service (re-)discovery may start again.
(_: Endpoint): void
Called when a connection is established or if the connection quality improves to a higher connection bandwidth.
(_: Endpoint & BandwidthInfo): void
Called when a payload is received from a remote endpoint. Depending on the type of the payload, all of the data may or may not have been received at the time of this call.
Called with progress information about an active payload transfer, either incoming or outgoing.
(_: Endpoint & PayloadTransferUpdate): void
Members | Value | Description | Since |
---|---|---|---|
CLUSTER |
'cluster' |
Peer-to-peer strategy that supports an M-to-N, or cluster-shaped, connection topology. No restrictions on the amount of incoming and outgoing connections. | 1.0.0 |
STAR |
'star' |
Peer-to-peer strategy that supports a 1-to-N, or star-shaped, connection topology. Restricts the discoverer to a single connection, while advertisers have no restrictions on amount of connections. | 1.0.0 |
POINT_TO_POINT |
'pointToPoint' |
Peer-to-peer strategy that supports a 1-to-1 connection topology. Restricts both adverisers and discoverers to a single connection. | 1.0.0 |
Members | Value | Description | Since |
---|---|---|---|
BALANCED |
'balanced' |
Nearby Connections will change the device's Wi-Fi or Bluetooth status only if necessary. | 1.0.0 |
DISRUPTIVE |
'disruptive' |
Nearby Connections will change the device's Wi-Fi or Bluetooth status to enhance throughput. | 1.0.0 |
NON_DISRUPTIVE |
'nonDisruptive' |
Nearby Connections should not change the device's Wi-Fi or Bluetooth status. | 1.0.0 |
Members | Value | Description | Since |
---|---|---|---|
BYTES |
'bytes' |
A Payload consisting of a single byte array. | 1.0.0 |
FILE |
'file' |
A Payload representing a file on the device. | 1.0.0 |
STREAM |
'stream' |
A Payload representing a real-time stream of data; e.g. generated data for which the total size is not known ahead of time. | 1.0.0 |
Members | Value | Description | Since |
---|---|---|---|
SUCCESS |
'success' |
The remote endpoint has successfully received the full transfer. | 1.0.0 |
CANCELED |
'canceled' |
Either the local or remote endpoint has canceled the transfer. | 1.0.0 |
FAILURE |
'failure' |
The remote endpoint failed to receive the transfer. | 1.0.0 |
IN_PROGRESS |
'inProgress' |
The the transfer is currently in progress with an associated progress value. | 1.0.0 |
Members | Value | Description | Since |
---|---|---|---|
UNKNOWN |
'unknown' |
The manager’s state is unknown. | 1.0.0 |
RESETTING |
'resetting' |
A state that indicates the connection with the system service was momentarily lost. | 1.0.0 |
UNSUPPORTED |
'unsupported' |
A state that indicates this device doesn’t support the Bluetooth low energy central or client role. | 1.0.0 |
UNAUTHORIZED |
'unauthorized' |
A state that indicates the application isn’t authorized to use the Bluetooth low energy role. | 1.0.0 |
POWERED_OFF |
'poweredOff' |
A state that indicates Bluetooth is currently powered off. | 1.0.0 |
POWERED_ON |
'poweredOn' |
A state that indicates Bluetooth is currently powered on and available to use. | 1.0.0 |
Members | Value | Description |
---|---|---|
OK |
'OK' |
The operation was successful. |
ERROR |
'ERROR' |
The operation failed, without any more information. |
NETWORK_NOT_CONNECTED |
'NETWORK_NOT_CONNECTED' |
|
ALREADY_ADVERTISING |
'ALREADY_ADVERTISING' |
The app is already advertising; call stopAdvertising() before trying to advertise again. |
ALREADY_DISCOVERING |
'ALREADY_DISCOVERING' |
The app is already discovering the specified application ID; call stopDiscovery() before trying to advertise again. |
ALREADY_CONNECTED_TO_ENDPOINT |
'ALREADY_CONNECTED_TO_ENDPOINT' |
The app is already connected to the specified endpoint. Multiple connections to a remote endpoint cannot be maintained simultaneously. |
CONNECTION_REJECTED |
'CONNECTION_REJECTED' |
The remote endpoint rejected the connection request. |
NOT_CONNECTED_TO_ENDPOINT |
'NOT_CONNECTED_TO_ENDPOINT' |
The remote endpoint is not connected; messages cannot be sent to it. |
RADIO_ERROR |
'RADIO_ERROR' |
There was an error trying to use the phone's Bluetooth/WiFi/NFC capabilities. |
ALREADY_HAVE_ACTIVE_STRATEGY |
'ALREADY_HAVE_ACTIVE_STRATEGY' |
The app already has active operations (advertising, discovering, or connected to other devices) with another Strategy . Stop these operations on the current Strategy before trying to advertise or discover with a new Strategy . |
OUT_OF_ORDER_API_CALL |
'OUT_OF_ORDER_API_CALL' |
The app called an API method out of order (i.e. another method is expected to be called first). |
UNSUPPORTED_PAYLOAD_TYPE_FOR_STRATEGY |
'UNSUPPORTED_PAYLOAD_TYPE_FOR_STRATEGY' |
|
ENDPOINT_UNKNOWN |
'ENDPOINT_UNKNOWN' |
An attempt to interact with a remote endpoint failed because it's unknown to us -- it's either an endpoint that was never discovered, or an endpoint that never connected to us (both of which are indicative of bad input from the client app). |
ENDPOINT_IO_ERROR |
'ENDPOINT_IO_ERROR' |
An attempt to read from/write to a connected remote endpoint failed. |
PAYLOAD_IO_ERROR |
'PAYLOAD_IO_ERROR' |
An attempt to read/write data for a Payload of type FILE or STREAM failed. |
PAYLOAD_UNKNOWN |
'PAYLOAD_UNKNOWN' |
|
ALREADY_LISTENING |
'ALREADY_LISTENING' |
|
AUTH_ERROR |
'AUTH_ERROR' |
|
ALREADY_IN_USE |
'ALREADY_IN_USE' |
This error indicates that Nearby Connections is already in use by some app, and thus is currently unavailable to the caller. |
Members | Value | Description | Since |
---|---|---|---|
UNKNOWN |
'unknown' |
||
LOW |
'low' |
The connection quality is poor (5KBps) and is not suitable for sending files. It's recommended you wait until the connection quality improves. | 1.0.0 |
MEDIUM |
'medium' |
The connection quality is ok (60~200KBps) and is suitable for sending small files. For large files, it's recommended you wait until the connection quality improves. | 1.0.0 |
HIGH |
'high' |
The connection quality is good or great (6MBps~60MBps) and files can readily be sent. The connection quality cannot improve further but may still be impacted by environment or hardware limitations. | 1.0.0 |