Back

SetWifiApEnabled

JS Py
Hello World

En/Disable the mobile Wifi Access Point of the device.

app.SetWifiApEnabled( enable, ssid?, key? )

You can define a custom WiFi AP name and a password as credentials for other people.
It automatically disabled WiFi if it was enabled.

This method is available for Android 6 or older only!

See Also: IsWifiApEnabled, IsWifiEnabled

Example - WiFi Access Point

function OnStart()
{
    lay = app.CreateLayout( "linear", "VCenter,FillXY" );

    tgl = app.CreateToggle( "WiFi Access Point", -1, 0.1 );
    tgl.SetOnTouch( tgl_OnTouch );
    lay.AddChild( tgl );

    app.AddLayout( lay );
}

function tgl_OnTouch( enable )
{
    if( enable ) app.SetWifiApEnabled( true, "DS Wifi AP", "mypass" );
    else app.SetWifiApEnabled( false );

}
from native import app

def OnStart():
    lay = app.CreateLayout( "linear", "VCenter,FillXY" )

    tgl = app.CreateToggle( "WiFi Access Point", -1, 0.1 )
    tgl.SetOnTouch( tgl_OnTouch )
    lay.AddChild( tgl )

    app.AddLayout( lay )

def tgl_OnTouch( enable ):
    if enable:
        app.SetWifiApEnabled( True, "DS Wifi AP", "mypass" )
    else:
        app.SetWifiApEnabled( False )
    Copy     Copy All       Run      
Boolean
String