Created
March 11, 2014 01:19
-
-
Save guilhermecarvalhocarneiro/9477764 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.setContentType("application/json;charset=UTF-8"); | |
se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json;charset=UTF-8")); | |
httppostreq.setEntity(se); | |
HttpResponse httpresponse = httpclient.execute(httppostreq); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment