Link to home
Start Free TrialLog in
Avatar of Yann de Champlain
Yann de ChamplainFlag for Canada

asked on

Have experience coding for HotSpot on Android V6-7?

Problem to turn On HotSpot on Android 6+
It works on Android 4.4-5 but restricted on V6+.

Anybody having experience working with HotSpot on Android V6-7?

  /**
     * Turn On or Off wifi
     *
     * @param context
     * @param isTurnToOn
     */
    public static void turnOnOffWifi(Context context, boolean isTurnToOn) {
        WifiManager wifiManager = (WifiManager) context
                .getSystemService(Context.WIFI_SERVICE);

        if (isTurnToOn && isHotspotSupported() && isHotspotOn(context)) {
            turnOnOffHotspot(context, false);
        }

        wifiManager.setWifiEnabled(isTurnToOn);
        if(isTurnToOn){
            writeLog(context, "turn on WIFI");
        }else{
            writeLog(context, "turn off WIFI");
        }
    }

Open in new window



We followed this tuto: http://omtlab.com/android-enable-disable-hotspot-programmatically/ made in 2014.

I do not get any error message. It just won't open the Hotspot.  Closing Wifi works however. (We close Wifi before we enable the HotSpot)
ASKER CERTIFIED SOLUTION
Avatar of Jackie Man
Jackie Man
Flag of Hong Kong image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Yann de Champlain

ASKER

Haven't tried the solution but I give the point for the effort...