novoda/merlin

Mobile connection type enhancements

florianmski opened this issue · 0 comments

Problem

Merlin currently exposes a getMobileNetworkSubtypeName() method that delegate to the framework NetworkInfo.getSubtypeName() method. This is returning a string representation of the mobile connection subtype (UMTS, LTE...). The problem is that I couldn't find anywhere in the framework code where this mapping occurs which means that I cannot use this method to do something actionable depending on a certain type of network.
What I ended up doing was using the ConnectivityManager to retrieve a NetworkInfo object which has a getSubtype() method returning an int coming from the TelephonyManager. From there I can specifically map those ints to whatever I need.

Potential Solution

Simple solution:
Expose another method on MerlinsBeard, for instance getMobileNetworkSubtype that delegates to NetworkInfo.getSubtype() and let us devs do the mapping

More involved solution:
Expose another method on MerlinsBeard, for instance getMobileNetworkSubtype that returns an Enum for instance which maps the TelephonyManager ints to an internal Merlins Enum.

Impact

None