@Override
        protected Integer doInBackground(String... item) {
         //Create a new HttpClient and Post Header
            HttpClient client = new DefaultHttpClient();
            String postURL = getString(R.string.WebServiceURL) + "/login/msubmit";
            
            //Prepare post method
            HttpPost post = new HttpPost(postURL);
            UrlEncodedFormEntity ent = null;
            try {
             //Add parameters to the post method
             List<NameValuePair> params = new ArrayList<NameValuePair>();
             params.add(new BasicNameValuePair("strUserId",   et_user.getText().toString()));  //사용자가 입력한 id
             params.add(new BasicNameValuePair("strPassword", et_pass.getText().toString()));  //사용자가 입력한 pw
             params.add(new BasicNameValuePair("strJumin2",   "1000000"));  //사용자가 입력한 주민번호 뒷자리
             params.add(new BasicNameValuePair("cv",   getCurrentVersion()));      //현재 어플 버전 정보
             params.add(new BasicNameValuePair("dv",   "android"));         //아이폰인지 안드로이드인지 구분
             params.add(new BasicNameValuePair("ip",   getLocalIpAddress()));      //ip주소
             
             android.util.Log.e("BB", "strUserId: "+et_user.getText().toString());
             android.util.Log.e("BB", "strPassword: "+et_pass.getText().toString());
//             android.util.Log.e("BB", "strJumin2: "+et_company.getText().toString());
             android.util.Log.e("BB", "cv: "+getCurrentVersion());
             android.util.Log.e("BB", "dv: "+"android");
             android.util.Log.e("BB", "ip: "+getLocalIpAddress());
             
                ent = new UrlEncodedFormEntity(params, HTTP.UTF_8);
                post.setEntity(ent);
                
                //Execute HTTP Post Request
                HttpResponse responsePOST = client.execute(post);
                if (responsePOST.getStatusLine().getStatusCode() != HttpStatus.SC_OK)
                    throw new IOException("Unexpected Http status code " + responsePOST.getStatusLine().getStatusCode());
                HttpEntity entity = responsePOST.getEntity();
                String result = null;
                if(entity != null){
                    result = EntityUtils.toString(entity, "UTF8");
                    android.util.Log.e("BB", "result : " + result);
                    
                    Map<String, Object> json = (Map<String, Object>) JSONValue.parse(result);
                    String boolFlag = json.get("boolFlag")  == null ? "" : (String) json.get("boolFlag");  //로그인 할수있는지 없는지..
                    userRealId      = json.get("strUserId") == null ? "" : (String) json.get("strUserId");  //cm_id1210  실제 사용자 id 리턴..
                    userName      = json.get("cUserName") == null ? "" : (String) json.get("cUserName");  //사용자 이름
                    userHp        = json.get("hp")        == null ? "" : (String) json.get("hp");    //사용자 전화번호
                    userEmail       = json.get("email")     == null ? "" : (String) json.get("email");   //사용자 이메일
                    userMobileImg   = json.get("mobileImgNoExtension") == null ? "noimage" : (String) json.get("mobileImgNoExtension"); //사용자 이미지 저장된 url 주소
                    snstalkYn       = json.get("snstalkYn")  == null ? "N" : (String) json.get("snstalkYn"); //SNS Talk 노티 알림 유무
                    strMessage      = json.get("strMessage") == null ? null : (String) json.get("strMessage"); //에러 메시지
                    
                    android.util.Log.e("BB", "boolFlag : " + boolFlag);
                    android.util.Log.e("BB", "userRealId : " + userRealId);
                    android.util.Log.e("BB", "userName : " + userName);
                    android.util.Log.e("BB", "userHp : " + userHp);
                    android.util.Log.e("BB", "userEmail : " + userEmail);
                    android.util.Log.e("BB", "userMobileImg : " + userMobileImg);
                    android.util.Log.e("BB", "snstalkYn : " + snstalkYn);
                    android.util.Log.e("BB", "strMessage : " + strMessage);
                    
                    if(boolFlag.equals("true")){
                        return 1;
                    }else{
                        return 0;
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return 0;
        }


 

Post방식으로 아이디, 패스워드 등등의 정보를 서버로 보낸후에

Json 방식으로 리턴을 받는 부분입니다.

 

이게 다른버전에선 전혀 문제없이 잘 됩니다.  현재 마켓에 어플 올려서 서비스 한지도 꽤 되었구요...

 

근데 갤럭시 넥서스나 갤S2 아이스크림 샌드위치에서는 리턴값을 못받습니다.

 

정확히는  HttpEntity entity = responsePOST.getEntity();  이부분 까지는 로그를 찍어보면 나오는데

 

result = EntityUtils.toString(entity, "UTF8"); 여기부터는 null 이 나옵니다;

 

 

ICS 에서 post 방식으로 리턴값을 받는거 해보신분 도움좀 부탁합니다.

 

ㅠ.ㅠ

profile