2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
Wi-Fi 優先ネットワーク オフロード スキャン
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Wi-Fi 優先ネットワーク オフロード(PNO)スキャンは、Wi-Fi 接続が解除されて画面がオフのときに定期的に実行される低電力 Wi-Fi スキャンです。PNO スキャンは、保存されたネットワークを検索して接続するために行われます。このスキャンは、フレームワークにより NL80211_CMD_START_SCHED_SCAN
コマンドを使用してスケジュールされます。詳しくは、nl80211.h をご覧ください。
Android 9 以前のデバイスでは、デバイスの Wi-Fi 接続が解除されて画面がオフになっている場合、最初の 3 回のスキャンでは 20 秒間隔で PNO スキャンが実行され、その後はすべてのスキャンにおいて 60 秒ごとに 1 回の頻度までスキャン回数が減ります。保存されたネットワークが検出されるか、画面がオンになると、PNO スキャンは停止します。
Android 10 には、WifiManager
に setDeviceMobilityState()
という名前の API メソッドがオプションで導入されており、デバイスのモビリティ状態に基づいて PNO スキャンの間隔を広げて、消費電力を削減します。
モビリティ状態には次のものがあります。
DEVICE_MOBILITY_STATE_UNKNOWN
: 不明なモビリティ
DEVICE_MOBILITY_STATE_HIGH_MVMT
: 自転車または自動車
DEVICE_MOBILITY_STATE_LOW_MVMT
: ウォーキングまたはランニング
DEVICE_MOBILITY_STATE_STATIONARY
: 移動なし
デバイスが移動していない場合、Android フレームワークは PNO スキャンの間隔を 60 秒から 180 秒に延長して、電力消費を抑えます。このような最適化を行う理由は、デバイスが移動していないときに PNO スキャンをしても、新しいネットワークを発見できる可能性は低いためです。
デバイスが他のモビリティ状態にある場合、またはメソッドが呼び出されない場合、デフォルトの PNO スキャン動作を実行します。
実装
Android 10 以降を搭載するデバイスにこの電力最適化機能を実装するには、デバイスのモビリティ情報を取得して、カスタム システムアプリから setDeviceMobilityState()
メソッドを呼び出します。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-03-26 UTC。
[null,null,["最終更新日 2025-03-26 UTC。"],[],[],null,["Wi-Fi preferred network offload (PNO) scans are low-powered Wi-Fi scans that\noccur at regular intervals when a device is disconnected from Wi-Fi and the\nscreen is off. PNO scans are used to find and\nconnect to saved networks. These scans are scheduled by the framework using the\n`NL80211_CMD_START_SCHED_SCAN` command. For more information, see\n[nl80211.h](https://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git/tree/include/uapi/linux/nl80211.h).\n\nOptimize power usage with device mobility information\n\nOn devices running Android 9 or lower, when the device\nis disconnected from Wi-Fi and the screen is off, PNO scans occur at 20 second\nintervals for the first three scans, then slow down to one scan every 60 seconds\nfor all subsequent scans. PNO scanning stops when a saved network is found or\nthe screen is turned on.\n\nAndroid 10 introduces an optional API method named\n[`setDeviceMobilityState()`](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/modules/Wifi/framework/java/android/net/wifi/WifiManager.java?q=func:setDeviceMobilityState)\nin `WifiManager` that increases the interval between\nPNO scans based on the device's mobility state to reduce power consumption.\n\nThe possible mobility states are:\n\n- `DEVICE_MOBILITY_STATE_UNKNOWN`: Unknown mobility\n- `DEVICE_MOBILITY_STATE_HIGH_MVMT`: On a bike or in a motor vehicle\n- `DEVICE_MOBILITY_STATE_LOW_MVMT`: Walking or running\n- `DEVICE_MOBILITY_STATE_STATIONARY`: Not moving\n\nIf the device is stationary, the Android framework increases the\ninterval between PNO scans from 60 seconds to 180 seconds to reduce power\nconsumption. This optimization is made on the assumption that the device is\nunlikely to find any new networks in PNO scans when the device is not moving.\n\nIf the device is in any other mobility state or if the method isn't called, the\ndevice uses the default PNO scan behavior.\n\nImplementation\n\nTo implement this power-optimizing feature on a device running Android\n10 or higher, derive the device mobility information\nand call the `setDeviceMobilityState()` method from a custom system app."]]