Problems with DNS on Android

I received reports from several users that they can’t enter our application (which makes HTTP calls to our website) or visit our website in their browser, so I added the code to our last build to check which The IP address of our hostname is resolved. Now I have received reports from several different users who get 127.0.0.1 for our hostname when the application starts, which obviously will not work.

They claim that they do not have proxy software, and this happens on both 2.1 and 2.2. This also happens on both Wi-Fi and 3G, which makes me suspect that the phone has some software that somehow interferes with DNS resolution. Does anyone know of any popular software that can do this? Or does anyone have ideas on how to determine which software can do this?

Thank,

+3
source share
3 answers
import org.xbill.DNS.Lookup;
import org.xbill.DNS.Record;
import org.xbill.DNS.TXTRecord;
import org.xbill.DNS.TextParseException;
import org.xbill.DNS.Type;

public class DNSLookUpActivity extends Activity {
    private String url = "https://spectracore.americanlogistics.com/rdac/AdmissionController/CheckMddAdmission";

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        funDNS(url);

    }

    private static void funDNS(String url) {

        try {
            Lookup lookup = new Lookup(url, Type.ANY);
            Record[] records = lookup.run();

            if (lookup.getResult() == Lookup.SUCCESSFUL) {
                String responseMessage = null;
                String listingType = null;
                for (int i = 0; i < records.length; i++) {
                    if (records[i] instanceof TXTRecord) {
                        TXTRecord txt = (TXTRecord) records[i];
                        for (Iterator j = txt.getStrings().iterator(); j
                                .hasNext();) {
                            responseMessage += (String) j.next();
                        }
                        Log.e("TXRecord ", "" + responseMessage);
                    } else if (records[i] instanceof ARecord) {
                        listingType = ((ARecord) records[i]).getAddress()
                                .getHostAddress();
                        Log.e("ARecord address : ", "" + listingType);
                    }
                }
            }
        } catch (TextParseException e) {
            e.printStackTrace();
        }

    }
}
Need android ask version 2.3.3 or above
+1
source

Get their DNS configuration and try your DNS servers directly with dig or nslookup. This is not ideal, but he has a good chance to show you the problem.

0
source

dnsjava/org.xbill.DNS Android, Scott Means DNSQuery :

http://smeans.com/programming/dns-queries-in-java/

0
source

Source: https://habr.com/ru/post/1752140/


All Articles