Switching to Android Marshmallow API, I was using org.apache.http.conn.util.InetAddressUtils for InetAddressUtils.isIPv4Address(ipAddress) in a cod
Like I interprete from the comments you can replace that function with this comparison:
inetAddress instanceof Inet4Address
so your code would end in:
if(!inetAddress.isLoopbackAddress() && inetAddress instanceof Inet4Address) {
Update from 2020
Keep in mind that your user can also have IPv6 enabled. In that case you need to check for Inet6Address too.