Android에서 Proxy를 사용하는지 체크하는 경우 System.getProperty를 이용하는 방법이 존재한다.


System.getProperty(key) - 운영체제나 JVM에 의존적인 정보를 알아낼 때 사용하는 함수로써 시스템정보를 불러옴


Example)

package com.example.taehwan.proxy_integrity;

import android.provider.Settings;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.net.Proxy;
import android.util.Log;
import android.widget.*;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView textview = (TextView)findViewById(R.id.test);
// String proxy=Settings.Secure.getString(getBaseContext().getContentResolver(),Settings.Secure.HTTP_PROXY);
if(System.getProperty("http.proxyHost")!=null) {
textview.setText(System.getProperty("http.proxyHost"));
}
else
{
textview.setText("NULL!!");
}
}
}



위 방법 외에도 Settings.Secure를 이용한 방법도 존재하지만 조금더 찾아 봐야 할 것 같다..


혹시 Settings.Secure를 이용하여 Proxy Check하는 방법을 알고 계신 분은 댓글로 

예제 부탁드립니다.

====================================================================='17.12.28추가

Settings.Secure의 HTTP_PROXY옵션은 API 17 이상부터 보안취약점 때문에 사용하지 않는다고 합니다.




+ Recent posts