amazon web services - AWS Identity TVM registration from android -


in identity tvm registration, instead of redirecting user identity tvm register.jsp register, can directly username , password of user through application(because user must register use application) , send them identity tvm registration registered. if yes, how it?

i had same problem. answer came send http post request within app replicates happens on registration form.

you need create new layout captures username , password (i copied file login_menu.xml, renamed register_menu.xml , changed of widget ids)

in original login.java file changed onclick action register button redirect new activity called register.java

in register.java use register_menu.xml layout file , when person clicks register button following code run (it gets run within asynctask):

        string registration_url = (propertyloader.getinstance().usessl() ? "https://" : "http://") + propertyloader.getinstance().gettokenvendingmachineurl() + "/registeruser";          url url = new url(registration_url);          map<string,object> params = new linkedhashmap<string,object>();         params.put("username", username);         params.put("password", password);          stringbuilder postdata = new stringbuilder();         (map.entry<string,object> param : params.entryset()) {             if (postdata.length() != 0) postdata.append('&');             postdata.append(urlencoder.encode(param.getkey(), "utf-8"));             postdata.append('=');             postdata.append(urlencoder.encode(string.valueof(param.getvalue()), "utf-8"));         }         byte[] postdatabytes = postdata.tostring().getbytes("utf-8");           httpurlconnection conn = (httpurlconnection)url.openconnection();         conn.setreadtimeout(10000 /* milliseconds */);         conn.setconnecttimeout(15000 /* milliseconds */);         conn.setdooutput(true);         conn.setdoinput(true);         conn.setinstancefollowredirects(false);          conn.setrequestmethod("post");         conn.setrequestproperty("content-type", "application/x-www-form-urlencoded");         conn.setrequestproperty("content-length", string.valueof(postdatabytes.length));         conn.setusecaches (false);          conn.getoutputstream().write(postdatabytes);         conn.getoutputstream().flush();          response = conn.getresponsecode();         log.d(debug_tag, "the response is: " + response);         return response; 

i picked of code other stackoverflow posts how generate http post using java (java - sending http parameters via post method easily) , android dev site network connection best practices (http://developer.android.com/training/basics/network-ops/connecting.html)

this should started on own implementation.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -