Set or View “Advanced Wi-fi” Settings programatically

前端 未结 2 797
夕颜
夕颜 2021-01-05 11:16

I need a way to open the \"Advanced wifi\" settings programatically to let the user change some of the settings, or, preferably, to change these advanced wireless settings p

相关标签:
2条回答
  • 2021-01-05 11:39

    There are two more settings that might work for you:

    From the API documentation:

    • Settings.ACTION_WIRELESS_SETTINGS

      startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS));
      
    • Settings.ACTION_WIFI_IP_SETTINGS

      startActivity(new Intent(android.provider.Settings.ACTION_WIFI_IP_SETTINGS));
      

    Try those two and see if they open what you're after.

    0 讨论(0)
  • 2021-01-05 11:44

    Here is the code snippet to open WIFI settings page

    Intent intent = new Intent(Intent.ACTION_MAIN, null);
        intent.addCategory(Intent.CATEGORY_LAUNCHER);
        ComponentName cn = new ComponentName("com.android.settings", "com.android.settings.wifi.WifiSettings");
        intent.setComponent(cn);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity( intent);
    
    0 讨论(0)
提交回复
热议问题