Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
JSONObject jsonobj; // declared locally so that it destroys after serving its purpose
jsonobj = new JSONObject();
JSONObject header = new JSONObject();
jsonobj.put("nome", "Guilherme");
jsonobj.put("pais", "Brasil");
jsonobj.put("chave", regIdGCMService.toString());
jsonobj.put("Authorization", "Token 0d0c898a1c26235f25f256ed853c9a09f3dce8bd");
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httppostreq = new HttpPost(wurl);
StringEntity se = new StringEntity(jsonobj.toString());
Log.i("JSONObject", jsonobj.toString());
se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json;charset=UTF-8"));
HttpResponse httpresponse = httpclient.execute(httppostreq);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.