D2D framework implementation - Post mortem

This post is a post-mortem about the implementation of Venice1, a device-to-device (D2D) communication framework leveraging D2D technologies, such as Bluetooth and Wi-Fi, to transparently enable communication between two devices.

I developed a demonstration application allowing to exchange files and text between two smartphones, using QRCode, Bluetooth Low Energy (BLE) and Wi-Fi interchangeably.

Here are some personal thoughts about this project.


Since the aim for this framework is to support D2D communication in a transparent way for as many platforms as possible, it made sense to use Flutter to write it.

In this context, it was a good choice because Flutter involves writing one codebase for all platforms; this is especially true regarding the user interface: Material Design specification is well implemented within Flutter, allowing for fast prototyping and a UI that looks the same on Android, iOS, Windows and Linux.

One annoying aspect I learnt about is the modular aspect of the framework, that allows developers to write an interface in Dart and its implementations using native languages. This allows easier cooperation between different communities on a single package, as each community can implement its favourite platform; it is however a struggle for single developers to support a package on all platforms (this point is however valid for all multiplatform frameworks, and not specific to Flutter).

Android barriers

To prove the concept behind the framework, I wanted to first support communications between smartphones, and thus focused Android as first platform; while doing so, I encountered a few difficulties:

Hotspot connection

The Wi-Fi data channel package currently relies on a Wi-Fi hotspot, i.e. one device starts a Wi-Fi access point, and the other connects to it.

Using my Pixel 4a phone to test it, I didn’t expect the Wi-Fi network joining process to be that tedious!

  1. After the connect method invocation, Wi-Fi network is not joined;
  2. You manually have to open the Wi-Fi settings page, only to see that Wi-Wi network is listed as “available through app”, and is not in a connected state;
  3. When tapping the network to join it, an additional popup window appears to inform user network does not have any Internet connection, requiring user to press a button to join said network;
  4. Network is only joined after the popup message has been discarded (at last!).

API differences

The previous hotspot connection point is about Android 13; we found the hard way that things were different using other Android versions.

For instance, using Android 11, hotspot connection process is different (with the same code base):

  • The Wi-Fi settings page is automatically opened;
  • New Wi-Fi network appears, but as password-protected, and tapping it requires user to enter a password;
  • User has to press the “back” button to go back to the app, the Wi-Fi network is then automatically joined.

Android has to cover a variety of hardware, and this is sometimes (annoyingly) visible through behaviors like this one.

  1. The Venice framework relies on a set of abstractions that include modeling D2D technologies as communication channels: more information on the project repository