<tfoot id='K5dIO'></tfoot>
      • <bdo id='K5dIO'></bdo><ul id='K5dIO'></ul>
      <legend id='K5dIO'><style id='K5dIO'><dir id='K5dIO'><q id='K5dIO'></q></dir></style></legend>

      1. <i id='K5dIO'><tr id='K5dIO'><dt id='K5dIO'><q id='K5dIO'><span id='K5dIO'><b id='K5dIO'><form id='K5dIO'><ins id='K5dIO'></ins><ul id='K5dIO'></ul><sub id='K5dIO'></sub></form><legend id='K5dIO'></legend><bdo id='K5dIO'><pre id='K5dIO'><center id='K5dIO'></center></pre></bdo></b><th id='K5dIO'></th></span></q></dt></tr></i><div id='K5dIO'><tfoot id='K5dIO'></tfoot><dl id='K5dIO'><fieldset id='K5dIO'></fieldset></dl></div>
      2. <small id='K5dIO'></small><noframes id='K5dIO'>

        以编程方式设置 Android IP、DNS、GATEWAY 设置

        时间:2023-07-08
          <tbody id='EtLLg'></tbody>
      3. <legend id='EtLLg'><style id='EtLLg'><dir id='EtLLg'><q id='EtLLg'></q></dir></style></legend>
          <tfoot id='EtLLg'></tfoot>

                • <bdo id='EtLLg'></bdo><ul id='EtLLg'></ul>

                  <small id='EtLLg'></small><noframes id='EtLLg'>

                  <i id='EtLLg'><tr id='EtLLg'><dt id='EtLLg'><q id='EtLLg'><span id='EtLLg'><b id='EtLLg'><form id='EtLLg'><ins id='EtLLg'></ins><ul id='EtLLg'></ul><sub id='EtLLg'></sub></form><legend id='EtLLg'></legend><bdo id='EtLLg'><pre id='EtLLg'><center id='EtLLg'></center></pre></bdo></b><th id='EtLLg'></th></span></q></dt></tr></i><div id='EtLLg'><tfoot id='EtLLg'></tfoot><dl id='EtLLg'><fieldset id='EtLLg'></fieldset></dl></div>
                  本文介绍了以编程方式设置 Android IP、DNS、GATEWAY 设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如何从android java设置wifi ip地址、dns地址、网关,即以编程方式,我没有找到任何能够存储值的方法.

                  How do I set wifi ip address, dns address, gateway from android java i.e programmatically, I didn't find any method which has the capability to store the values.

                  推荐答案

                  您可以通过编程方式更改系统设置.

                  You can change system settings programatically.

                  首先,您需要在AndroidManifest.xml"中请求WRITE_SETTINGS"权限:

                  First you need to request the 'WRITE_SETTINGS' permission in your 'AndroidManifest.xml':

                  <uses-permission android:name="android.permission.WRITE_SETTINGS"/>
                  

                  然后您需要使用以下代码实际更改设置:

                  Then you need to actually change the setting using the following code:

                      android.provider.Settings.System.putString(getContentResolver(), android.provider.Settings.System.WIFI_USE_STATIC_IP, "0");
                      android.provider.Settings.System.putString(getContentResolver(), android.provider.Settings.System.WIFI_STATIC_DNS1, "192.168.0.2");
                      android.provider.Settings.System.putString(getContentResolver(), android.provider.Settings.System.WIFI_STATIC_DNS2, "192.168.0.3");
                      android.provider.Settings.System.putString(getContentResolver(), android.provider.Settings.System.WIFI_STATIC_GATEWAY, "192.168.0.1");
                      android.provider.Settings.System.putString(getContentResolver(), android.provider.Settings.System.WIFI_STATIC_NETMASK, "255.255.255.0");
                      android.provider.Settings.System.putString(getContentResolver(), android.provider.Settings.System.WIFI_STATIC_IP, "1");
                  

                  可以通过相同的方法访问当前设置,但使用getString"而不是putString".

                  The current settings can be accessed via the same method but use 'getString' instead of 'putString'.

                  有关设置选项的信息,请访问此处的参考:Settings.System |安卓开发者

                  For information about the settings option visit the reference here: Settings.System | Android Developers

                  这篇关于以编程方式设置 Android IP、DNS、GATEWAY 设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Android Volley,重复的 Set-Cookie 被覆盖 下一篇:如何使用 RingtoneManager.ACTION_RINGTONE_PICKER 设置铃声?

                  相关文章

                  • <bdo id='Q8WFk'></bdo><ul id='Q8WFk'></ul>
                  <legend id='Q8WFk'><style id='Q8WFk'><dir id='Q8WFk'><q id='Q8WFk'></q></dir></style></legend>
                • <small id='Q8WFk'></small><noframes id='Q8WFk'>

                    <i id='Q8WFk'><tr id='Q8WFk'><dt id='Q8WFk'><q id='Q8WFk'><span id='Q8WFk'><b id='Q8WFk'><form id='Q8WFk'><ins id='Q8WFk'></ins><ul id='Q8WFk'></ul><sub id='Q8WFk'></sub></form><legend id='Q8WFk'></legend><bdo id='Q8WFk'><pre id='Q8WFk'><center id='Q8WFk'></center></pre></bdo></b><th id='Q8WFk'></th></span></q></dt></tr></i><div id='Q8WFk'><tfoot id='Q8WFk'></tfoot><dl id='Q8WFk'><fieldset id='Q8WFk'></fieldset></dl></div>

                  1. <tfoot id='Q8WFk'></tfoot>