마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

Android WiFi 와 Data Network 관련 질문입니다.

0 추천
안드로이드 WiFi와 Data Network에 관해 질문드릴게 있습니다.

예를 들어, 안드로이드 스마트폰에서 Data Network를 사용하다가 WiFi 버튼을 On 시켜서 두 가지 모두를 활성화 시켰을 경우

우선순위 때문에 WiFi 만 사용이 가능하고 Data Network는 자동으로 차단 된다고 알고 있습니다.

이 때, 이런 우선순위를 정해주는 것을 바꿔주고 싶은데 어느 부분에 그런 코드가 있는지 궁금해서 이렇게 질문 올립니다.
sangjin5609 (140 포인트) 님이 2014년 7월 13일 질문

1개의 답변

0 추천

안녕하세요.

 

현재로서는 다음과 같이 preference를 바꿀수 있습니다.

        mConnectivityManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
        mConnectivityManager.setNetworkPreference(ConnectivityManager.TYPE_MOBILE);
 
하지만 doc에서 guide 하듯이 곧 deprecate될 API 입니다.

public void setNetworkPreference (int preference)

Added in API level 1

Specifies the preferred network type. When the device has more than one type available the preferred network type will be used. Note that this made sense when we only had 2 network types, but with more and more default networks we need an array to list their ordering. This will be deprecated soon.

 

 

 

fanoyong (1,440 포인트) 님이 2014년 7월 16일 답변
...