Java-通过android进行Amazon调用
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Java-通过android进行Amazon调用,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1857字,纯文字阅读大概需要3分钟。
内容图文
![Java-通过android进行Amazon调用](/upload/InfoBanner/zyjiaocheng/651/4718dde09b41401abce3bd152aa32af7.jpg)
我想从Android执行对Amazon API的剩余调用.
Amazon要求所有ws呼叫都将使用HMAC签名(基于哈希的消息身份验证代码)进行身份验证.
我缺少与Apache Base64对象相似的对象来签署我的请求.
有没有一种简单的方法可以在Android中做到这一点,甚至更好的是有一个适用于Amazon Web服务的Android客户端(产品广告API).
解决方法:
您应该能够只在项目中包括Apache Base64软件包.
查看此:http://www.delaytolerant.com/android-http-managing-base64-with-apache-commons-codec/
或者,如果有任何基于Java的Amazon客户端,您是否尝试过将这些jars包含在Android项目中?
显然,上面的链接现在不可用了.以下是Google’s cache的页面内容:
This post continues on programming
HTTP within Android. In the following,
I’ll show how to manage Base64 coded
content in Android and how to render
an image on WebView from a String that
we encoded.First, the tool to use is commons
codec package from Apache. The
documentation can be found here. The
source is available here. You can just
include the source of the package to
your project, it is all Android
compatible.The commons codec package has also
convenient method for Base64 decoding,
String imageString = "";
try {
FileInputStream fin = openFileInput("camera.jpg");
int jpeg_size = fin.available();
byte[] imagedata = new byte[jpeg_size];
fin.read(imagedata);
byte[] encodedData = Base64.encodeBase64(imagedata);
imageString = new String(encodedData);
final String mimetype = "text/html";
final String encoding = "UTF-8";
// replace below [ with html "<" and ] similarly ] with ">"
String html = "[html][body][center][img height=\"200\" width=\"200\"
src=\"data:image/jpeg;base64,"+imageString+"\"/][/center][/body][/html]";
mWebView.loadData(html, mimetype, encoding);
} catch (Exception e) {
e.printStackTrace();
}
There is also convenient Base64
decoding functionality in the package,
which can be used for example, to
decode Base64 encoded content in MIME
messages, which were covered in
previous post.
内容总结
以上是互联网集市为您收集整理的Java-通过android进行Amazon调用全部内容,希望文章能够帮你解决Java-通过android进行Amazon调用所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。