Moreover generating the authentication token seems to be tricky too. I am struck with this right now. Did anyone on this earth ever tried uploading an image/video from Android using Java client or Json API and succeeded? I don't see any sample which is proven to work on Android. On Android, I tried using the json api to upload an image. I am able to upload an image object but it seems to be corrupt. Execute(post BufferedReader reader new BufferedReader(new InputStreamReader(tContent String eachLine null; StringBuilder builder new StringBuilder while (eachLine adLine! null) builder. append(eachLine L.d response " String JSONO bject object new JSONO bject(String String name tString name return name; catch (IOException e) int(e catch (JSONE xception e) int(e return null; I am running into two issues here. Can someone point me in the right direction please. It has been very disappointing experience with this Storage api from Google. Please share your experiences if someone did it. Below is the code that I am trying from Android while trying to use the GCS's JSON API.
Private static String uploadFile(RichMedia media) DefaultHttpClient client new DefaultHttpClient Bitmap bitmap tLocalUrl HttpPost post new HttpPost(GCS_ROOT tLocalUrl rrentTimeMillis if(tType RichMedia. RichMediaType.PICTURE ) tHeader Content-Type "image/jpeg else tHeader Content-Type "video/mp4 tHeader Authorization "AIzaSyCzdmCMwiMzl6LD7R2obF0xSgnnx5rEfeI tHeader Content-Length tByteCount ByteArrayOutputStream stream new ByteArrayOutputStream EG, 100, stream byte byteArray ByteArray try tEntity(new StringEntity(new Gson.toJson(byteArray).toString HttpResponse response client.