Android WifiManager

class enamlnative.android.android_wifi.WifiManager(*args, **kwargs)[source]

Bases: enamlnative.android.android_content.SystemService

Access android’s WifiManager. Use the static class methods.

To Get networks use:

WifiManager.get_networks().then(on_results)

It will request and enable if wifi allowed. Returns None if access is denied otherwise the list of networks.

To check if wifi is enabled use:

WifiManager.is_wifi_enabled().then(on_result)

Returns None if access is denied otherwise the result

To set wifi enabled use:

WifiManager.set_wifi_enabled(state=True).then(on_result)

Returns None if access is denied otherwise the result

async classmethod is_wifi_enabled() bool[source]

Check if wifi is currently enabled.

Returns

result – Whether wifi is enabled

Return type

bool

async classmethod set_wifi_enabled(state: bool = True) bool[source]

Set the wifi enabled state.

Returns

enabled – Whether the operation succeeded.

Return type

bool

async classmethod get_networks()[source]

Get the wifi networks currently available.

Returns

result – A future that resolves with the list of networks available or None if wifi could not be enabled (permission denied, etc…)

Return type

future

async classmethod disconnect()[source]

Disconnect from the current network (if connected).

Returns

result – A future that resolves to true if the disconnect was successful. Will be set to None if the change network permission is denied.

Return type

future

async classmethod connect(ssid, key=None, **kwargs)[source]

Connect to the given ssid using the key (if given).

Returns

result – A future that resolves with the result of the connect

Return type

future

async classmethod get_connection_info()[source]

Get info about current wifi connection (if any). Returns info such as the IP address, BSSID, link speed, signal, etc..

result: future

A future that resolves with a dict of the connection info or None if an error occurred (ie permission denied).

async classmethod get_dhcp_info()[source]

Get info about current DHCP configuration such as DNS servers, IP address, and lease duration.

Returns

result – A future that resolves with a dict of the DHCP info or None if an error occured (ie permission denied).s

Return type

future

async classmethod request_permission(*permissions) bool[source]

Requests permission and returns an future result that returns a boolean indicating if all the given permission were granted or denied.

__del__()[source]

Remove any receivers before destroying