안녕하세요ㅠ 아무리 해도 해결이 되지 않아서 너무 죄송하지만 다시 소스를 올립니다.
아래와 같이 스레드에서 파라미터를 보내면(ud값을 임의값으로 설정한 경우) 정상적으로 url을 타고 웹에 파라미터가 모두 전달이 되고 구글 마켓으로 이동을 합니다. 스레드에서 ud값(json으로 세 개의 값을 파싱해서 Base64로 인코딩한 값임)을 인식할 수 있는 방법이 있을까요?
public class EclCPAPost extends AsyncTask<String, Void, HttpResponse>{
private Context ctx;
public EclCPAPost(Context context) {
this.ctx = context;
}
@Override
protected HttpResponse doInBackground(String... params) {
new Thread() {
final String adid = "";
final String ipAddress = "";
// processing_Data2(adid, ipAddress,"");//""이곳에 아래에서 추출한 ud값을 넣고 싶습니다.
Log.e("", "processing_Data2"+ line2);
}
}.start();
// onT2(adid, ipAddress, "");//""이곳에 아래에서 추출한 ud값을 넣고 싶습니다.
}
@SuppressLint("HandlerLeak")
private Handler buiHandler = new Handler() {
@SuppressLint("HandlerLeak")
public void handleMessage(Message msg) {
try {
JSONObject json = new JSONObject(page);
JSONArray jArr = json.getJSONArray("items");
for (int i=0; i<jArr.length(); i++) {
json = jArr.getJSONObject(i);
int keyno = Integer.parseInt(json.getString("keyno"));
String str = String.valueOf(keyno);
String keyvalue = json.getString("keyvalue");
String packagename = json.getString("packagename");
final String userid = json.getString("userid");
final String ad_no = json.getString("ad_no");
final String ecloud = json.getString("ecloud");
final String ud = Base64.encodeToString((userid + "&ad_no=" + ad_no + "&ecloud=" + ecloud).getBytes(),0);
Log.d("ud1", ud);
WifiManager wm = (WifiManager) getSystemService(WIFI_SERVICE);
DhcpInfo dhcpInfo = wm.getDhcpInfo() ;
int serverIp = dhcpInfo.gateway;
final String ipAddress = String.format(
"%d.%d.%d.%d",
(serverIp & 0xff),
(serverIp >> 8 & 0xff),
(serverIp >> 16 & 0xff),
(serverIp >> 24 & 0xff));
Log.d("IP", ipAddress);
onT2(adid,ipAddress,ud);
}
} catch (Exception e){
}
}
};
public void onT2(String adid, String ipAddress, String ud) {
URL url = null;
try {
url = new URL("http://www.appang.kr/nas/api/join.json.asp?" + "ajip=" + ipAddress + "&os=" + os + "&ap=" + ap + "&a=" + a +"&ua=" + adid + "&ud=" + ud);
Log.d("F1", url.toString());
public void processing_Data2(String adid, String ipAddress, String ud) {
URL url = null;
HttpURLConnection urlConnection = null;
BufferedInputStream buf = null;
try {
Log.e("", "processing_Data1"+ line2);
// URL 접속
url = new URL("http://www.appang.kr/nas/api/join.json.asp?" + "ajip=" + ipAddress + "&os=" + os + "&ap=" + ap + "&a=" + a +"&ua=" + adid + "&ud=" + ud);