먼저 웹브라우저에서 PHP파일을 직접적으로 실행 시, 데이터베이스에 정상적으로 값이 들어가는것을 확인했습니다.
따라서 PHP파일 자체에는 문제가 없다고 생각합니다.
get이나 post방식의 통신방식이 아닌, 그냥 php파일을 한번 실행만 시켜주면 되기에 AsyncTask 예제를 보고 아래와같이 만들어보았는데 동작하지 않습니다. (Log.e는 출력됩니다.)
class AccumulateTask extends AsyncTask<Integer, Integer, Integer> {
@SuppressWarnings("deprecation")
protected void onPreExecute() {
}
protected Integer doInBackground(Integer... arg0) {
try {
URL text = new URL(
"~~~~/swc/test.php");
HttpURLConnection conn = (HttpURLConnection) text.openConnection();
conn.connect();
Log.e("hi", "send");
} catch (Exception e) {
}
return null;
}
protected void onProgressUpdate(Integer... progress) {
}
protected void onPostExecute(Integer result) {
}
protected void onCancelled() {
}
}
무엇이 문제인지 알려주시면 감사하겠습니다.