首页 > 代码库 > 解决Android 5.0 (移动网络待机)耗电问题

解决Android 5.0 (移动网络待机)耗电问题

1. 耗电原因

Android 5.0 增加判断网络状态的特性, 判断原理是测试链接google的一个网址. 但是google被墙了, 所以就会造成移动网络频繁的测试链接, 并且网络图标上面的那个感叹号.

详细请参考:http://blog.csdn.net/matrix_laboratory/article/details/43271473


2. 解决方法

修改测试链接网址:

<code style="word-wrap: break-word; font-family: monospace, serif; font-size: 1em;"><span class="pln" style="word-wrap: break-word;">adb shell </span><span class="str" style="word-wrap: break-word;">"settings put global captive_portal_server xxxxxxx"</span></code>
比如:

<code style="word-wrap: break-word; font-family: monospace, serif; font-size: 1em;"><span class="pln" style="word-wrap: break-word;"></span></code><pre class="prettyprint prettyprinted" name="code" style="font-size: 13.63636302948px; line-height: 26px; white-space: pre-wrap; word-wrap: break-word; background-color: rgb(255, 255, 255);"><code style="word-wrap: break-word; font-family: monospace, serif; font-size: 1em;"><span class="pln" style="word-wrap: break-word;">adb shell </span><span class="str" style="word-wrap: break-word;">"settings put global captive_portal_server <span style="box-sizing: border-box; word-wrap: break-word; font-family: 'Merriweather Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16.3636360168457px; line-height: 22.6909084320068px;"><span style="box-sizing: border-box; word-wrap: break-word; font-size: 16.3636360168457px; line-height: 22.6909084320068px;">www.265.com</span></span>"</span></code>
<span class="pln" style="font-family: monospace, serif; font-size: 1em; word-wrap: break-word;">adb shell </span><span class="str" style="font-family: monospace, serif; font-size: 1em; word-wrap: break-word;">"settings put global captive_portal_server xn--yet824cpd.xn--fiqs8s"</span>

<code style="word-wrap: break-word; font-family: monospace, serif; font-size: 1em;"><span class="str" style="word-wrap: break-word;"></span></code><pre class="prettyprint prettyprinted" name="code" style="font-size: 13.63636302948px; line-height: 26px; white-space: pre-wrap; word-wrap: break-word; background-color: rgb(255, 255, 255);"><code style="word-wrap: break-word; font-family: monospace, serif; font-size: 1em;"><span class="pln" style="word-wrap: break-word;">adb shell </span><span class="str" style="word-wrap: break-word;">"settings put global captive_portal_server <span style="box-sizing: border-box; word-wrap: break-word; font-family: 'Merriweather Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16.3636360168457px; line-height: 22.6909084320068px;">liukebin.sinaapp.com</span>"</span></code>
<code style="word-wrap: break-word; font-family: monospace, serif; font-size: 1em;"><span class="str" style="word-wrap: break-word;"></span></code>

3. 参考文献

<code style="word-wrap: break-word; font-family: monospace, serif; font-size: 1em;"><span class="str" style="word-wrap: break-word;">https://xn--yet824cpd.xn--fiqs8s/45.html</span></code>


解决Android 5.0 (移动网络待机)耗电问题