안드로이드 네트워크 속도 제한 - andeuloideu neteuwokeu sogdo jehan

무제한 인터넷을 사용하는 경우 무의식적으로 핫스팟이 켜놧을수 있는데 HotSpot을 켜놓으면 다른사람들이 자신의 모바일데이터를 함께 사용하기 때문에 인터넷 속도를 저하시키고 배터리 소모를 증가시키는 요소가 됩니다.

안드로이드 네트워크 속도 제한 - andeuloideu neteuwokeu sogdo jehan
안드로이드 네트워크 속도 제한 - andeuloideu neteuwokeu sogdo jehan
핸드폰 인터넷 속도 저하요인 핫스팟

핸드폰 인터넷 속도 느려질 경우 핫스팟을 늘 확인하고 비활성화 합니다.

IP우회 VPN DNS 비활성화

모바일 뿐만 아니라 노트북, 데스크탑 PC등 인터넷 보안 및 인터넷속도를 빠르게도 하지만 반대로 느리게도 할 수 있는 요소가 바로 가상 IP주소를 사용하느것입니다.

안드로이드 네트워크 속도 제한 - andeuloideu neteuwokeu sogdo jehan
안드로이드 네트워크 속도 제한 - andeuloideu neteuwokeu sogdo jehan
인터넷 보안으로 VPN 사용을 추천하지만 인터넷 속도 저하됩니다.

일부 IP우회 어플리케이션을 사용하여 다른 국가의 IP로 접속하게 되면 국내에서 사용하는것보다 인터넷 속도가 비약적으로 느려질 수 있기 때문에 IP우회 어플리케이션을 사용하고 있다면 비활성화 합니다.

스마트폰 사용 기간 동안 모바일 데이터 요금제 비용이 기기 자체의 비용을 초과하는 일은 쉽게 일어납니다. Android 7.0(API 수준 24) 이상에서 사용자는 기기의 데이터 사용량을 최적화하고 줄이기 위해 기기 전체에서 데이터 절약 모드를 사용 설정할 수 있습니다. 이 기능은 로밍 중이거나, 결제 주기가 끝날 무렵일 때, 소액 선불 데이터 팩을 사용 중인 경우에 특히 유용합니다.

사용자가 설정에서 데이터 절약 모드를 사용 설정하고 기기가 데이터 전송량 제한이 있는 네트워크를 사용 중인 경우, 시스템은 백그라운드 데이터 사용을 차단하고 가능하면 포그라운드에서 데이터를 덜 사용하도록 앱에 신호를 보냅니다. 사용자는 데이터 절약 모드가 사용 설정된 경우에도 특정 앱이 전송량 제한이 있는 상태로 백그라운드 데이터를 사용하도록 허용할 수 있습니다.

Android 7.0(API 수준 24)은 ConnectivityManager API를 확장하여 사용자의 데이터 절약 모드 환경설정을 가져오고 환경설정 변경사항을 모니터링하는 방법을 앱에 제공합니다. 앱에서 사용자가 데이터 절약 모드를 사용 설정했는지 확인하고, 포그라운드 및 백그라운드 데이터 사용량을 제한하기 위해 노력하는 것이 좋습니다.

데이터 절약 모드 환경설정 확인

Android 7.0(API 수준 24) 이상에서 앱은 ConnectivityManager API를 사용하여 적용되는 데이터 사용량 제한을 확인할 수 있습니다. getRestrictBackgroundStatus() 메서드는 다음 값 중 하나를 반환합니다.

RESTRICT_BACKGROUND_STATUS_DISABLED데이터 절약 모드가 사용 중지되었습니다.RESTRICT_BACKGROUND_STATUS_ENABLED사용자가 이 앱에 데이터 절약 모드를 사용 설정했습니다. 앱은 포그라운드의 데이터 사용량을 제한하고 백그라운드 데이터 사용량 제한을 적절히 처리하도록 해야 합니다.RESTRICT_BACKGROUND_STATUS_WHITELISTED사용자가 데이터 절약 모드를 사용 설정했지만, 앱에서 우회할 수 있습니다. 앱에서 여전히 포그라운드 및 백그라운드 데이터 사용량을 제한하기 위해 노력해야 합니다.

데이터 절약 모드가 사용 중지되어 있거나 앱에서 우회할 수 있더라도 기기가 데이터 전송량 제한이 있는 네트워크에 연결될 때마다 데이터 사용량이 제한됩니다. 다음 샘플 코드는 ConnectivityManager.isActiveNetworkMetered()ConnectivityManager.getRestrictBackgroundStatus()를 사용하여 앱에 허용되는 데이터 사용량을 결정합니다.

Kotlin

(getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager).apply {
    // Checks if the device is on a metered network
    if (isActiveNetworkMetered) {
        // Checks user’s Data Saver settings.
        when (restrictBackgroundStatus) {
            RESTRICT_BACKGROUND_STATUS_ENABLED -> {
                // Background data usage is blocked for this app. Wherever possible,
                // the app should also use less data in the foreground.
            }
            RESTRICT_BACKGROUND_STATUS_WHITELISTED -> {
                // The app is allowed to bypass Data Saver. Nevertheless, wherever possible,
                // the app should use less data in the foreground and background.
            }
            RESTRICT_BACKGROUND_STATUS_DISABLED -> {
                // Data Saver is disabled. Since the device is connected to a
                // metered network, the app should use less data wherever possible.
            }
        }
    } else {
        // The device is not on a metered network.
        // Use data as required to perform syncs, downloads, and updates.
    }
}

자바

ConnectivityManager connMgr = (ConnectivityManager)
        getSystemService(Context.CONNECTIVITY_SERVICE);
// Checks if the device is on a metered network
if (connMgr.isActiveNetworkMetered()) {
  // Checks user’s Data Saver settings.
  switch (connMgr.getRestrictBackgroundStatus()) {
    case RESTRICT_BACKGROUND_STATUS_ENABLED:
    // Background data usage is blocked for this app. Wherever possible,
    // the app should also use less data in the foreground.

    case RESTRICT_BACKGROUND_STATUS_WHITELISTED:
    // The app is allowed to bypass Data Saver. Nevertheless, wherever possible,
    // the app should use less data in the foreground and background.

    case RESTRICT_BACKGROUND_STATUS_DISABLED:
    // Data Saver is disabled. Since the device is connected to a
    // metered network, the app should use less data wherever possible.
  }
} else {
  // The device is not on a metered network.
  // Use data as required to perform syncs, downloads, and updates.
}

참고: Android TV에서는 다르게 작동합니다. Android TV는 백그라운드 데이터 사용을 차단하는 대신 제한하기만 합니다. 애플리케이션이 사용할 수 있는 데이터 속도는 포그라운드에 있을 때 800Kbps로 제한되고 백그라운드에 있을 때는 10Kbps로 제한됩니다.

ConnectivityManager connMgr = (ConnectivityManager)
        getSystemService(Context.CONNECTIVITY_SERVICE);
// Checks if the device is on a metered network
if (connMgr.isActiveNetworkMetered()) {
  // Checks user’s Data Saver settings.
  switch (connMgr.getRestrictBackgroundStatus()) {
    case RESTRICT_BACKGROUND_STATUS_ENABLED:
    // Background data usage is blocked for this app. Wherever possible,
    // the app should also use less data in the foreground.

    case RESTRICT_BACKGROUND_STATUS_WHITELISTED:
    // The app is allowed to bypass Data Saver. Nevertheless, wherever possible,
    // the app should use less data in the foreground and background.

    case RESTRICT_BACKGROUND_STATUS_DISABLED:
    // Data Saver is disabled. Since the device is connected to a
    // metered network, the app should use less data wherever possible.
  }
} else {
  // The device is not on a metered network.
  // Use data as required to perform syncs, downloads, and updates.
}
0를 사용하여 TV의 데이터 사용량을 제한할 시기를 감지합니다.

데이터 제한 권한 요청

앱이 백그라운드에서 데이터를 사용해야 하는 경우, 앱의 패키지 이름의 URI(예:

ConnectivityManager connMgr = (ConnectivityManager)
        getSystemService(Context.CONNECTIVITY_SERVICE);
// Checks if the device is on a metered network
if (connMgr.isActiveNetworkMetered()) {
  // Checks user’s Data Saver settings.
  switch (connMgr.getRestrictBackgroundStatus()) {
    case RESTRICT_BACKGROUND_STATUS_ENABLED:
    // Background data usage is blocked for this app. Wherever possible,
    // the app should also use less data in the foreground.

    case RESTRICT_BACKGROUND_STATUS_WHITELISTED:
    // The app is allowed to bypass Data Saver. Nevertheless, wherever possible,
    // the app should use less data in the foreground and background.

    case RESTRICT_BACKGROUND_STATUS_DISABLED:
    // Data Saver is disabled. Since the device is connected to a
    // metered network, the app should use less data wherever possible.
  }
} else {
  // The device is not on a metered network.
  // Use data as required to perform syncs, downloads, and updates.
}
1)가 포함된
ConnectivityManager connMgr = (ConnectivityManager)
        getSystemService(Context.CONNECTIVITY_SERVICE);
// Checks if the device is on a metered network
if (connMgr.isActiveNetworkMetered()) {
  // Checks user’s Data Saver settings.
  switch (connMgr.getRestrictBackgroundStatus()) {
    case RESTRICT_BACKGROUND_STATUS_ENABLED:
    // Background data usage is blocked for this app. Wherever possible,
    // the app should also use less data in the foreground.

    case RESTRICT_BACKGROUND_STATUS_WHITELISTED:
    // The app is allowed to bypass Data Saver. Nevertheless, wherever possible,
    // the app should use less data in the foreground and background.

    case RESTRICT_BACKGROUND_STATUS_DISABLED:
    // Data Saver is disabled. Since the device is connected to a
    // metered network, the app should use less data wherever possible.
  }
} else {
  // The device is not on a metered network.
  // Use data as required to perform syncs, downloads, and updates.
}
2 인텐트를 전송하여 데이터 제한 권한을 요청할 수 있습니다.

인텐트와 URI를 전송하면 설정 앱이 실행되고 앱의 데이터 사용량 설정이 표시됩니다. 그러면 사용자는 앱의 백그라운드 데이터 사용 여부를 결정할 수 있습니다. 이 인텐트를 전송하기 전에 먼저 사용자에게 백그라운드 데이터 사용을 허용할 목적으로 설정 앱을 실행할지 묻는 것이 좋습니다.

데이터 절약 모드 환경설정 변경 모니터링

앱은

ConnectivityManager connMgr = (ConnectivityManager)
        getSystemService(Context.CONNECTIVITY_SERVICE);
// Checks if the device is on a metered network
if (connMgr.isActiveNetworkMetered()) {
  // Checks user’s Data Saver settings.
  switch (connMgr.getRestrictBackgroundStatus()) {
    case RESTRICT_BACKGROUND_STATUS_ENABLED:
    // Background data usage is blocked for this app. Wherever possible,
    // the app should also use less data in the foreground.

    case RESTRICT_BACKGROUND_STATUS_WHITELISTED:
    // The app is allowed to bypass Data Saver. Nevertheless, wherever possible,
    // the app should use less data in the foreground and background.

    case RESTRICT_BACKGROUND_STATUS_DISABLED:
    // Data Saver is disabled. Since the device is connected to a
    // metered network, the app should use less data wherever possible.
  }
} else {
  // The device is not on a metered network.
  // Use data as required to perform syncs, downloads, and updates.
}
3를 수신 대기하기 위해
ConnectivityManager connMgr = (ConnectivityManager)
        getSystemService(Context.CONNECTIVITY_SERVICE);
// Checks if the device is on a metered network
if (connMgr.isActiveNetworkMetered()) {
  // Checks user’s Data Saver settings.
  switch (connMgr.getRestrictBackgroundStatus()) {
    case RESTRICT_BACKGROUND_STATUS_ENABLED:
    // Background data usage is blocked for this app. Wherever possible,
    // the app should also use less data in the foreground.

    case RESTRICT_BACKGROUND_STATUS_WHITELISTED:
    // The app is allowed to bypass Data Saver. Nevertheless, wherever possible,
    // the app should use less data in the foreground and background.

    case RESTRICT_BACKGROUND_STATUS_DISABLED:
    // Data Saver is disabled. Since the device is connected to a
    // metered network, the app should use less data wherever possible.
  }
} else {
  // The device is not on a metered network.
  // Use data as required to perform syncs, downloads, and updates.
}
4를 만들고
ConnectivityManager connMgr = (ConnectivityManager)
        getSystemService(Context.CONNECTIVITY_SERVICE);
// Checks if the device is on a metered network
if (connMgr.isActiveNetworkMetered()) {
  // Checks user’s Data Saver settings.
  switch (connMgr.getRestrictBackgroundStatus()) {
    case RESTRICT_BACKGROUND_STATUS_ENABLED:
    // Background data usage is blocked for this app. Wherever possible,
    // the app should also use less data in the foreground.

    case RESTRICT_BACKGROUND_STATUS_WHITELISTED:
    // The app is allowed to bypass Data Saver. Nevertheless, wherever possible,
    // the app should use less data in the foreground and background.

    case RESTRICT_BACKGROUND_STATUS_DISABLED:
    // Data Saver is disabled. Since the device is connected to a
    // metered network, the app should use less data wherever possible.
  }
} else {
  // The device is not on a metered network.
  // Use data as required to perform syncs, downloads, and updates.
}
5를 통해 수신기를 동적으로 등록하여 데이터 절약 모드 환경설정에 관한 변경사항을 모니터링할 수 있습니다. 앱은 브로드캐스트를 수신할 때 ConnectivityManager.getRestrictBackgroundStatus()를 호출하여 새 데이터 절약 모드 환경설정이 권한에 영향을 주는지 확인해야 합니다.

참고: 시스템에서는

ConnectivityManager connMgr = (ConnectivityManager)
        getSystemService(Context.CONNECTIVITY_SERVICE);
// Checks if the device is on a metered network
if (connMgr.isActiveNetworkMetered()) {
  // Checks user’s Data Saver settings.
  switch (connMgr.getRestrictBackgroundStatus()) {
    case RESTRICT_BACKGROUND_STATUS_ENABLED:
    // Background data usage is blocked for this app. Wherever possible,
    // the app should also use less data in the foreground.

    case RESTRICT_BACKGROUND_STATUS_WHITELISTED:
    // The app is allowed to bypass Data Saver. Nevertheless, wherever possible,
    // the app should use less data in the foreground and background.

    case RESTRICT_BACKGROUND_STATUS_DISABLED:
    // Data Saver is disabled. Since the device is connected to a
    // metered network, the app should use less data wherever possible.
  }
} else {
  // The device is not on a metered network.
  // Use data as required to perform syncs, downloads, and updates.
}
5를 사용하여 동적으로 수신기를 등록하는 앱에만 브로드캐스트를 전송합니다. 브로드캐스트를 수신하기 위해 매니페스트에 등록하는 앱은 이를 수신하지 못합니다.

Android 디버그 브리지 명령어로 테스트

Android 디버그 브리지(ADB)는 데이터 절약 모드 상태에서 앱을 테스트하는 데 사용할 수 있는 몇 가지 명령어를 제공합니다. 네트워크 권한을 확인 및 구성하거나 무선 네트워크를 데이터 전송량 제한 있음으로 설정하여 무제한 네트워크에서 앱을 테스트할 수 있습니다.