Http post

May 6 2015 5:48 AM
Hi friend i'd like to know the following code is correct or  not.
 protected void onCreate(Bundle savedInstanceState) {
        if (android.os.Build.VERSION.SDK_INT > 9) {
            StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
            StrictMode.setThreadPolicy(policy);
            String IMEI="1234566";
            String Phonemodel="Samsung";
            HttpClient httpClient=new DefaultHttpClient();
//        HttpPost httpPost=new HttpPost("http://localhost:50554/api/vetri?id="+Id+"&Imei="+Imei+"Btrylevel="+Battery);
            HttpPost httpPost1=new HttpPost("http://kredo.no-ip.org/SSMA/api/DevicesAPI/RegisterDevice?IMEI="+IMEI+"&Phonemodel="+Phonemodel);
            try {
                HttpResponse response=httpClient.execute(httpPost1);
            } catch (ClientProtocolException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
      }