Amazon to relax through android

I would like to make the rest of the calls in the Amazon API with Android. Amazon requires all ws calls to be authenticated using HMAC signatures (Hash-based authentication code). I skipped a similar object for the Apache Base64 object to sign my request. Is there an easy way to do this on Android, or is it even better to have an Android client for the Amazon web service (product advertising API).

+3
source share
2 answers

You should simply include the Apache Base64 package in your project.

See this: http://www.delaytolerant.com/android-http-managing-base64-with-apache-commons-codec/

, - Java- Amazon, Android?

-, . Google:

HTTP Android. , , Base64 Android WebView , .

-, - commons Apache. . . , Android .

Base64,

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();
}

Base64 , , , Base64 MIME , .

+2

url ​​( = URLEncoder.encode();)

+1

Source: https://habr.com/ru/post/1731403/


All Articles