Speedify SDK for Android  14.7.0
Network Sharing

As of version 14.0, Speedify SDK supports sharing cellular connections from mobile devices to other devices via Wi-Fi and/or Ethernet. These shared connections are used for VPN connection transports.

Permission Requirements

If you want to run network sharing, you need to add the CHANGE_WIFI_MULTICAST_STATE permission to your AndroidManifest.xml file. This permission is required to use the multicast DNS (MDNS) protocol, which is used for device discovery.

Overview

Devices discover each other via MDNS announcements and queries. Host devices (Android and iOS devices with cellular interfaces) announce themselves as network sharing hosts and run a TCP listen socket. Client devices query for hosts and connect to them. Command and control messaging is sent over these TCP sockets, with transport connections established over separate UDP sockets.

Configuration

setNetworkSharingClientEnabled and setNetworkSharingHostEnabled enable network sharing on the device.

A default display name is pulled from the device. This can be overridden with setNetworkSharingDisplayName.

Discovery

Discovery/discoverability phases are automatically initiated on network or user data changes, and last for 10 seconds. Discovery can also be manually initiated with startNetworkSharingDiscovery. Each call to this starts a discovery phase which lasts for 30 seconds.

Newly discovered peers are signaled via OnNetworkSharingNewPeerAvailable.

Pairing

Peers may be paired by calling requestNetworkSharingPair. This sends a pairing request to the peer, which is signaled via OnNetworkSharingPairRequest and accepted or rejected with allowNetworkSharingPair.

Pair requests may be set to be automatically accepted or rejected with setNetworkSharingPairRequestBehavior.

A peer may be removed with unpairNetworkSharingPeer.

Manual Connections

connectToNetworkShareViaConnectCode is used to manually connect to a network shared host via their connect code.

reconnectToNetworkShare reconnects to a previously authenticated network share peer.

Status

Currently available and previously paired peers are available via OnNetworkSharesAvailable.