通过 Wifi 投射到 Chromecast 时,我有用户抱怨在 Android 6 设备上失去连接。在查看日志时,我看到了这一点:
12-09 19:18:56.473 I/Router ( 5337): Connectivity change detected...
12-09 19:18:56.473 I/Router ( 5337): EXTRA_NO_CONNECTIVITY: true
12-09 19:18:56.473 I/Router ( 5337): EXTRA_REASON: null
12-09 19:18:56.473 I/Router ( 5337): EXTRA_IS_FAILOVER: false
12-09 19:18:56.473 I/Router ( 5337): EXTRA_NETWORK_INFO: [type: WIFI[], state: DISCONNECTED/DISCONNECTED, reason: (unspecified), extra: <unknown ssid>, roaming: false, failover: false, isAvailable: true]
12-09 19:18:56.473 I/Router ( 5337): EXTRA_OTHER_NETWORK_INFO: none
12-09 19:18:56.473 I/Router ( 5337): EXTRA_EXTRA_INFO: <unknown ssid>
12-09 19:18:56.475 I/NetworkUtils( 5337): Could not find any connected network...
12-09 19:18:57.475 W/Router ( 5337): WIFI => NONE network transition, waiting for new network... retry #1
12-09 19:18:57.476 I/Router ( 5337): Network type changed WIFI => MOBILE
12-09 19:18:57.477 I/Router ( 5337): WiFi multicast lock released
12-09 19:18:57.478 I/Router ( 5337): WiFi lock released
12-09 19:18:57.521 I/Router ( 5337): Disabled router on network type change (old network: WIFI)```
正如您可能猜到的那样,在投射过程中打开 Wifi 会导致问题。这似乎只是运行 Android 6 的设备的问题,所以我认为它与新的打盹模式有关。我看到打盹模式和前台服务已经确定前台服务不会打瞌睡(我可以确认这一点),但它似乎并没有阻止打盹删除必要的网络访问。虽然我还没有收到任何关于 DLNA 选角的投诉,但我想它也会有同样的问题。如果应用程序正在积极流式传输音乐并且无缘无故地被迫使用移动网络,这也会导致问题。有没有办法防止 Doze 在前台应用程序使用 Wifi 访问时关闭它?