Archived Forum Post

Index of archived forum posts

Question:

Android: using Example for CkHttp and QuickGetStr - not working

Jul 05 '17 at 04:07

Hello, I started to try out Chilkat-library with Android. I was able to print out the Chilkat-Version in a first Test, which I show in a TextView.

But if I try to output the result of a String I receive from http.quickGetstr I get an empty String.

Is it me doing it wrong, or is there a bug?

 public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        TextView tv = new TextView(this);

        CkCrypt2 crypt = new CkCrypt2();

        // Display the version of the CkCrypt2 class
        tv.setText(crypt.version()); //works and shows 9.5.0.68

        setContentView(tv);

        //now http request

        CkHttp http = new CkHttp();

        boolean success;

        //  Any string unlocks the component for the 1st 30-days.
        success = http.UnlockComponent("Anything for 30-day trial");
        if (success != true) {
           //---
            return;
        }

        //  Send the HTTP GET and return the content in a string.
        String html;
        html = http.quickGetStr("http://www.wikipedia.org/");

        tv.setText(html);

Accepted Answer

Check to see if this fixes the problem: Ensure that you have INTERNET permission in AndroidManifest.xml.


Answer

Solved it for me. Thank you very much!


Answer

It is very strange. What ever I try to use with CkHttp does not work!

All the other classes are working for me. I tested on Android Studio 2.3.3 and with Samsung Galaxy S7 and Virtual Devices.

I took 1:1 the examples from e.g.:

https://www.example-code.com/android/http_download_ip_port.asp

https://www.example-code.com/android/http_downloadFile.asp

Did try with and without my activation-key for CkHttp!


Answer

Here the error log attached:

Opening Websites inside device works. But not via Chilkat :-/

ChilkatLog:
     QuickGetStr:
       DllDate: May 28 2017
       ChilkatVersion: 9.5.0.68
       UnlockPrefix: XXXXXXXX
       Architecture: Little Endian; 32-bit
       Language: Android Java
       VerboseLogging: 0
       url: http://www.google.com
       httpRequestStr:
         a_quickReq:
           quickHttpRequest:
             httpVerb: GET
             url: http://www.google.com
             openHttpConnection:
               Opening connection directly to HTTP server.
               httpHostname: www.google.com
               httpPort: 80
               tls: 0
               socket2Connect:
                 connect2:
                   connectSocket:
                     connect_ipv6_or_ipv4:
                       getAddressInfo:
                         Failed to get host address info. (4)
                         errno: 7
                         osErrorMessage: Argument list too long
                         hostOrIpAddr: www.google.com
                         port: 80
                         Retrying DNS lookup...
                         Failed to get host address info. (4)
                         errno: 7
                         osErrorMessage: Argument list too long
                         hostOrIpAddr: www.google.com
                         port: 80
                       --getAddressInfo
                       getAddressInfo failed.
                     --connect_ipv6_or_ipv4
                   --connectSocket
                   ConnectFailReason: DNS lookup failed
                 --connect2
               --socket2Connect
             --openHttpConnection
           --quickHttpRequest
         --a_quickReq
       --httpRequestStr
       Failed.
     --QuickGetStr
   --ChilkatLog