CURL Library for Android

孤人 提交于 2019-12-13 04:27:13

问题


After much struggling, I managed to setup this Android NDK project on eclipse:

https://github.com/gcesarmza/curl-android-ios

...and now it runs. All it does is connect to www.google.com: This is the curl call I make in the Main Activity:

String url = "https://www.google.com";
byte[] content = downloadUrl(url);

I am new to NDK an this CURL library, how can I execute a more complex CURL request such as this file upload command??? :

curl -F file=@audio.wav http://myserver.com

回答1:


The test project that you reproduced does only this, downloadUrl.

If you want something else, you need to write (in C or C++) your own code that uses libCURL. You can start with a generic tutorial.

You will also need to define some JNI wrapper, e.g.

native bool pushFile(String file)

Alternatively, you can use an existing JNI wrapper.



来源:https://stackoverflow.com/questions/34268036/curl-library-for-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!