package com.codename1.nearby.transport

Sending bytes and files to a device in the same room, with no access point, no pairing and no internet.

Start at NearbyTransport.

Read the limitation before designing around this

This transport does not cross ecosystems. It is Google’s Nearby Connections on Android and Apple’s MultipeerConnectivity on iOS, and the two share no wire protocol, so an Android phone and an iPhone will never discover each other here no matter how the app is written. The API does not hide that, because an API that looked portable and silently never found the peer would be worse.

When both ends of the conversation are not the same platform, the framework already has two options that do work across the divide: com.codename1.bluetooth.le.L2capChannel for a raw byte stream over BLE, and com.codename1.io.bonjour plus sockets when both devices share a Wi-Fi network.

Types

class EndpointAnother device seen advertising the same service id.
class IncomingConnectionAn incoming request from another device that wants to connect, delivered to TransportListener.connectionRequested.
class NearbyTransportMoving bytes and files to a device that is physically nearby, with no access point, no pairing and no internet.
class PayloadSomething to send to a connected endpoint: either a block of bytes or a file.
enum PayloadStatusWhere a payload transfer got to, carried by PayloadTransferUpdate.
class PayloadTransferUpdateProgress on one payload, delivered to TransportListener.payloadProgress.
class TransportAdapterA TransportListener whose methods all do nothing, so a caller interested in two events overrides two methods.
interface TransportListenerReceives everything the nearby transport has to say.
enum TransportStrategyThe connection topology a transport session uses.