为Android curl库 [英] CURL Library for Android

查看:277
本文介绍了为Android curl库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很多挣扎后,我设置管理这个Android NDK项目上蚀:

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

......现在运行。它所做的是连接到www.google.com:
这是卷曲的呼叫我做的主要活动:

 字符串的URL =htt​​ps://www.google.com;
字节[] =内容downloadUrl(URL);

我是新来的NDK这个curl库,我怎么能执行一个更复杂的卷曲的要求,如该文件上传命令?

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


解决方案

这是你转载的测试项目只做这个,downloadUrl。

如果你想要别的东西,你需要写(在C或C ++),它使用的libcurl自己的code。你可以用href=\"http://curl.haxx.se/libcurl/c/libcurl-tutorial.html\" rel=\"nofollow\">通用教程一个

您还需要定义一些JNI的包装,例如

 本地布尔pushFile(字符串文件)

另外,您也可以使用现有的JNI包装

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

解决方案

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.

这篇关于为Android curl库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆