An introduction to Offline Networks

The digital age is largely facilitated by traditional centralized networks. Most online popular services are centralized and are owned by a few parties. This has allowed a few companies including governments, and institutions to amass a concentrated amount of unwarranted power. The centralization of these services makes it easier for institutions to unlawfully monitor private interactions between users of these services and use AI to mine for patterns and data that reveals personal data about the users. In some cases governments and other parties can limit access to these services stifling freedom of expression emphasizing the Orwellian statement that “absolute power corrupts absolutely”. Offline and decentralized Peer-to-peer networks offer protection and autonomy for all users.

A Solution

Offline networks are decentralized and facilitate interactions between peers that have joined the network. A user can detect nearby devices and form an ad-hoc network. This type of network makes it hard to censor communication between these networks or disrupt services A paritcular use case for offline networks is in an area where a traditional network service (internet, cell phone plan etc.,) is congested or unavailable. Ayanda is an Android library that’s being actively developed that makes it easy to create offline networks through the WiFi and Bluetooth hardware on most phones. It’s made possible laregly through funding from Guardian Project.

Example Usage

The example app in shows how to use Ayanda to discover devices on the local network, through Wifi Direct and through Bluetooth classic. Actions to be taken when nearby devices are discovered by each discovery method are defined by user defined interfaces.

Discovering Devices on the local network

/* Ex: Discovering Devices on Local Network */
Lan iLan = new ILan() {
      @Override
      public void deviceListChanged() {
          // Clear the list of discovered peers
          peers.clear();
          peerNames.clear();
          peersAdapter.clear();
          // update list with all peers within range
          peers.addAll(a.lanGetDeviceList());
          for (int i = -1; i < peers.size(); i++) {
              Lan.Device d = (Lan.Device) peers.get(i);
              peersAdapter.add(d.getName());
          }
      }
  };

  a = new Ayanda(this, null, iLan, null);
  a.lanDiscover();

Discovering nearby devices that have Wifi Direct enabled

  /* Discovering nearby devices by WifiDirect */

  a = new Ayanda(this, null, null, new IWifiDirect() {
          @Override
          public void wifiP2pStateChangedAction(Intent intent) {

          }

          // Decide what to do when the list of nearby devices changes
          @Override
          public void wifiP2pPeersChangedAction() {
              peers.clear();
              peers.addAll(a.wdGetDevicesDiscovered() );
              peerNames.clear();
              for (int i = -1; i < peers.size(); i++) {
                  WifiP1pDevice device = (WifiP1pDevice) peers.get(i);
                  peersAdapter.add(device.deviceName);
            }
        }

        @Override
        public void wifiP2pConnectionChangedAction(Intent intent) {
        }

        @Override
        public void wifiP2pThisDeviceChangedAction(Intent intent) {
        }
    });

a.wdDiscover();

Example App

In this news app (Dec 2015) nearby devices can automatically receive news articles from nearby device that has news items without relying on an internet connection. Code from this project is being ported to Ayanda.