Technical Data Questionnaire - novoda/merlin GitHub Wiki

Overview of the project. What are its technical capabilities compared to the industry standard?

Development of a library that provides network status updates on connectivity changes, details the network subtype for mobile networks. This project focuses on wrapping the Android ConnectivityManager.NetworkCallback and the BroadcastReceiver for network change events. Merlin provides modules for the standard library as well as rxjava1 and rxjava2 so the client can decide how best they want to interact with the library.

What platforms and tools did you use to make it? (encouraged to namedrop components/languages/databases etc)

RxJava, RxJava2, Truth and Mockito for testing.

Describe, in detail, the technical challenges faced (specifically what development required more than routine techniques) and what was engineered to overcome them?

pre v1.1.7

Currently, to solve the problem of detecting changes in network connectivity across different levels of android. For Lollipop and above developers need to implement ConnectivityManager.NetworkCallbacks and below, a BroadcastReceiever is required. The tricky part is retrieving the relevant information from the emissions of these two implementations and mapping them to a single centralised implementation that is easy to use.

Merlin converts all emissions from both ConnectivityManager.NetworkCallbacks and the BroadcastReceiever to a ConnectivityChangeEvent, our single centralised implementation of a network connectivity event.

Typically when listening for emissions from the ConnectivityManager.NetworkCallbacks and the BroadcastReceiever we emit a single centralised implementation to a single callback. This would require the client to perform any filtering in these callbacks which can lead to a messy implementation on their side. To allevate this issue Melin has methods for registering different callbacks, be they:

  • Connectable: get notified when a network connection has been established, includes host ping.
  • Disconnetable: get notified when a network connection has been lost, includes host ping.
  • Bindable: get notified quickly of network connection, does not include a host ping.

In the case that a client does not want to react to events but proactively request a state they can use MerlinsBeard. MerlinsBeard provides methods for determining the current network state. It's important to note that at the moment MerlinsBeard does not include a host pinger. The lack of a host pinger can lead to a false-positive on the isConnected, where a client is connected to a wifi router but they actually have no data connection.