Don't Forget Ethernet

Some developers will make decisions in their apps based upon whether or not the device is on WiFi. In many, if not all, of those cases, the developer is thinking that there is a binary choice between WiFi and mobile data.

However, there is another option: wired Ethernet.

This will be used for:

  • Some TV-attached devices (Google TV, OUYA, etc.) where the user elected to hard-wire their device rather than use WiFi

  • Some tablets, where the user has attached a USB Ethernet adapter and is using a wired connection

As an example of the latter, I was planning on using such an adapter with my first-generation ASUS Transformer Infinity for my AnDevCon Boston 2013 presentation on Maps V2. WiFi in conferences can be a bit shaky, and so I had requested a wired Internet connection. The bad news: that wired connection did not reach the Internet. The good news: the WiFi was solid, so my demos could run.

If you are making decisions based on Internet connection type, please check your code and see whether or not you are going to correctly handle the Ethernet scenario. ConnectivityManager should return TYPE_ETHERNET for such environments.

Interested in Jetpack Compose? has a weekly newsletter of the latest articles, samples, and other details of Compose development!