Open the system window



  • Please indicate how the program opens the window of the line.WLAN access point"

    startActivity(
    new Intent(Settings.ACTION_WIRELESS_SETTINGS));
    

    This code opens a window of "Best Lines," but until the window,WLAN access point And two more moves to be made.

    I can't get any closer, maybe who knows, please.



  • Try that.

    Intent intent = new Intent(Settings.ACTION_APN_SETTINGS);
    startActivity(intent);
    

    and may require rights.

    android.permission.WRITE_APN_SETTINGS
    

    UPDATE

    We need WiFi hostspot to control (inclusion/disable)

    Rights

    android.permission.ACCESS_WIFI_STATE
    android.permission.CHANGE_WIFI_STATE
    android.permission.ACCESS_NETWORK_STATE
    

    Code itself

     /**
     * включение/отключение WiFi hostspot.
     * 
     * @param context
     * @param isTurnToOn
     */
    public static void turnOnOffHotspot(Context context, boolean isTurnToOn) {
        WifiManager wifiManager = (WifiManager) context
                .getSystemService(Context.WIFI_SERVICE);
        WifiApControl apControl = WifiApControl.getApControl(wifiManager);
        if (apControl != null) {
    
    // ЕСЛИ WIFI ВКЛЮЧЕН, ОТКЛЮЧИТЕ ЕЕ СПЕРВА
    //if (isWifiOn(context) && isTurnToOn) {
    //  turnOnOffWifi(context, false);
    //}
    
    // Тут включается Hotspot
    apControl.setWifiApEnabled(apControl.getWifiApConfiguration(), isTurnToOn);
    }
    

    }




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2