Page 466 - 2
P. 466

}
                          Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDE
            R);


                          if (location == null) {
                              location = getLastKnownLocation();
                          }
                          startx = String.valueOf(location.getLongitude());
                          starty = String.valueOf(location.getLatitude());


                          endx = String.valueOf(E_POI.getPOIPoint().getLongitude());
                          endy = String.valueOf(E_POI.getPOIPoint().getLatitude());
                          endpoiid = E_POI.getPOIID();
                          endrpflag = E_POI.rpFlag;

                          try {
                              endname = URLEncoder.encode(E_POI.getPOIName(), "UTF-8");
                          } catch (UnsupportedEncodingException e) {
                              e.printStackTrace();
                          }
                          new Thread(new Runnable() {
                              @Override
                              public void run() {
                                 Intent intent = new Intent(context,LocationCheckActivity.class);
                                 intent.putExtra("ParsingData",getJson());
                                 context.startActivity(intent);
                              }
                          }).start();
                       }
                       public String getJson(){
                          String param;
                          String result = null;
                          try {
                              URL url = new URL("http://apis.skplanetx.com/tmap/routes");
                              HttpURLConnection conn = (HttpURLConnection) url.openConnection();
                              conn.setRequestProperty("Host", "apis.skplanetx.com");
                              conn.setRequestProperty("appKey", "c6311b50-7799-3f45-97fc-94e969f6564e");
                              conn.setRequestProperty("Accept-Language", "ko");
                              conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");


                              //Host: apis.skplanetx.com
                              //appKey: 1234-5678-9012-3456
                              //Accept-Language: ko
                              //Content-Type: application/x-www-form-urlencoded
                              conn.setRequestMethod("POST");

                              conn.setConnectTimeout(3000);
                              conn.setReadTimeout(3000);


                              conn.setDoOutput(true);


                                                         - 466 -
   461   462   463   464   465   466   467   468   469   470   471