Skip to content Skip to sidebar Skip to footer

Using Google Blobstore With An Android Application

I found 1 thread about this question, which did partially answer the question, but I'm afraid I may need some details. I'm currently trying to use BlobStore with my android app, an

Solution 1:

Ok, after some search, here is the solution ;

It seems that headers are not working as I expected, so I just deleted them.

HttpPosthttppost=newHttpPost(url);
MultipartEntityentity=newMultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
entity.addPart("data", newByteArrayBody(image,"image/jpeg","avatar.jpg"));
httppost.setEntity(entity);
response = httpClient.execute(httppost);
processResponse(response);

Solution 2:

I used the following and it worked.

This is an example if you post as gzip content:

ByteArrayOutputStreambaos=newByteArrayOutputStream();
    GZIPOutputStreamgzos=null;
    try {
        gzos = newGZIPOutputStream(baos);
        gzos.write(xml.getBytes());
    } finally {
        if (gzos != null)
            try {
                gzos.close();
            } catch (IOException ex) {
            }
    }

    byte[] fooGzippedBytes = baos.toByteArray();
    MultipartEntityentity=newMultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
    entity.addPart("name", newByteArrayBody(fooGzippedBytes,"application/x-gzip", "filename"));

    httpPost.setEntity(entity);

Post a Comment for "Using Google Blobstore With An Android Application"