How can I overlay a 'back' and 'next' button on a “ pick wifi network ” window?

后端 未结 2 1884
陌清茗
陌清茗 2021-01-18 02:32

Google play does this when you try to use it and happen to not be connected to a wifi network.

photo of what I\'m trying to do:

相关标签:
2条回答
  • 2021-01-18 02:53
        Intent intent = new Intent(WifiManager.ACTION_PICK_WIFI_NETWORK);       
        intent.putExtra("only_access_points", true);
        intent.putExtra("extra_prefs_show_button_bar", true);
        intent.putExtra("wifi_enable_next_on_connect", true);
        startActivityForResult(intent, 1);
    

    This should do it. Reverse engineered from google code.

    0 讨论(0)
  • 2021-01-18 03:00

    This is just an improvement of UncleKing's answer.

    Since you ask specifically for

    How can I get buttons overlayed on to what you see with a WifiManager.ACTION_PICK_WIFI_NETWORK?

    There is no need for the extras only_access_points and wifi_enable_next_on_connect. You only need the extra_prefs_show_button_bar extra. The overlay buttons will appear just by using this last extra.

    You can try this using ADB if you want:

    am start -a android.net.wifi.PICK_WIFI_NETWORK --ez extra_prefs_show_button_bar True
    

    So the reduced code would be:

    Intent intent = new Intent(WifiManager.ACTION_PICK_WIFI_NETWORK);       
    intent.putExtra("extra_prefs_show_button_bar", true);
    startActivityForResult(intent, 1);
    

    Tried it on Android 4.1, 4.4 and 5.1.

    0 讨论(0)
提交回复
热议问题