php ->
<?
if($_GET["id"] == "1234567" && $_GET["pwd"] = "1111"){
echo "\nwelcome ingbeeni<br />\n";
echo "date:".date("Y-m-d")."\n";
echo "id:". $_GET["id"]. "\n";
echo "password:" . $_GET["pwd"]." \n";
echo "file path:".$_SERVER["PHP_SELF"]." \n";
echo "login ip:".$_SERVER["REMOTE_ADDR"]."\n";
} else {
echo " id or password is not matched.[홍길동]\n";
echo "id:".$_GET["id"]." \n";
echo "pw:".$_GET["pwd"]." \n";
}
?>
chrome -> http://127.0.0.1/test.php?id=1234567&pwd=1111
오류 android.os.NetworkOnMainThreadException
-> 안드로이드 버전업으로 인한 예외발생
-> Main thread(UI) 에서 네트워크 호출을 무조건 error로 간주
-> 네트워크 작업을 UI스레드가 아닌 별도의 스레드에서 처리해야함
해결방안
-> AndroidManifest.xml파일에서 <uses-sdk >를 지우거나 주석처리
-> StrictMode ThreadPolicy를 수정
-> 못적음 하나더있음
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.s08"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"/>
<!--android:targetSdkVersion="18"-->
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.s08.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
MainActiviy.java
'이전것 > 개발' 카테고리의 다른 글
android -> Server -> xml (0) | 2016.07.08 |
---|---|
android -> Server -> android (0) | 2016.07.08 |
android -> webView (0) | 2016.07.07 |
android -> LifeCycle (0) | 2016.07.07 |
android -> binary search game (0) | 2016.07.07 |