Wget or similar for Android

I need to petition against the https server and download the data that the server sends back (text, video files or image files) inside my Android application.

It works fine in suse Linux terminal and wget or curl. The request has this structure:

wget --post-data "token=xxxx&option1=1&option2=4&File=video" https://api.serverx.com/ --no-check-certificate 

My question is whether there is any wget or similar running on Android, or how can I do similar petitions in a different way.

I read about the wget implementation in the NDK, but I would like to know your experience or recommendations. Thanks

Decision

Using the NDK for the Wget port was too complicated. After some research, I found a solution using DefaultHttpClient and added a couple of classes to avoid certificate validation. I follow this article

 SchemeRegistry schemeRegistry = new SchemeRegistry(); schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); schemeRegistry.register(new Scheme("https", new EasySSLSocketFactory(), 443)); HttpParams params = new BasicHttpParams(); params.setParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, 30); params.setParameter(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE, new ConnPerRouteBean(30)); params.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, false); HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1); ClientConnectionManager cm = new SingleClientConnManager(params, schemeRegistry); DefaultHttpClient httpClient = new DefaultHttpClient(cm, params); 
+4
source share
1 answer

Using wget or ndk for this is a bad idea: go directly to java and use HttpClient to create a mail request: an example can be found here .

The response will contain your data, ready to be saved to a file.

In addition, you can put it in an asynch task, execution tracking: forking an external process, such as Curl ou wget, should be saved as a last chance (that communication with the server obviously does not work)

+4
source

All Articles