Module created for Wi-Fi management in Android
Project description
wifidroid
Is a module created for Wi-Fi management in Android with Python, wifidroid has methods to connect to Wi-Fi networks with WPA / WPA2, WEP and public networks, it also has methods to scan Wi-Fi networks, turn Wi-Fi off or on, etc. you can use wifidroid on Pydroid3 and kivy / kivymd, wifidroid is compatible with most android api's.
Examples:
#Examples from Pydroid3
import kivymd,kivy
from wifidroid.wifi import WifiManager
#Connecting to a Wifi Network (For networks with WPA / WPA2 and WEP security
you must specify the network name and password, for public networks you must
only specify the network name)
#Example for WiFi networks with WPA/WPA2 security
wifi = WifiManager()
wifi.ConnectWifiWpa("WifiName","WifiPassword")
#Example for WiFi networks with WEP security
wifi = WifiManager()
wifi.ConnectWifiWep("WifiName","WifiPassword")
#Example for public WiFi networks
wifi = WifiManager()
wifi.ConnectWifiPublic("WifiName")
import kivymd,kivy
from wifidroid.wifi import WifiManager
#Activating Wifi (To activate it use True and to deactivate it use False
wifi = WifiManager()
wifi.EnabledWifi(True)
import kivymd,kivy
from wifidroid.wifi import WifiManager
#Scanning WiFi networks
#You must first instantiate the WifiManager class
#To scan Wi-Fi networks you must activate the location.
wifi = WifiManager()
wifi.startScan()
for i in range(wifi.ScanResults.size()):
#Getting SSID
ssid = [wifi.ScanResults.get(i).SSID]
#Getting BSSID
bssid = [wifi.ScanResults.get(i).BSSID]
#Getting signal
levell = [wifi.ScanResults.get(i).level]
#printing results
print(ssid[0]+" "+bssid[0]+" "+str(levell[0]))
Output:
[INFO ] [KivyMD ] v0.104.1
[INFO ] [Factory ] 184 symbols loaded
ALVAREZ 34:da:b7:d1:bc:75 -74
TURBONETT_0FB532 00:21:94:0f:b5:32 -80
import kivymd,kivy
from wifidroid.wifi import WifiManager
#Obtaining all the WiFi networks in the surroundings with their respective
information
#To scan Wi-Fi networks you must activate the location.
wifi = WifiManager()
wifi.startScan()
print(wifi.allScanResults)
Output:
[INFO ] [KivyMD ] v0.104.1
[INFO ] [Factory ] 184 symbols loaded
[SSID: TURBONETT_0FB532, BSSID: 00:21:94:0f:b5:32,
capabilities: [WPA2-PSK-CCMP][RSN-PSK-CCMP][ESS][WFA-HT],
level: -50, frequency: 2462, timestamp: 1996213092215, distance: ?(cm),
distanceSd: ?(cm), passpoint: no, ChannelBandwidth: 1, centerFreq0: 2452,
centerFreq1: 0, 80211mcResponder: is not supported, Carrier AP: no,
Carrier AP EAP Type: -1, Carrier name: null,
Radio Chain Infos: [RadioChainInfo: id=0, level=-50]]
These examples can be used in Pydroid3 and in a kivy / kivymd app
Important
Before using wifidroid make sure your android app has the following permissions: CHANGE_WIFI_STATE, ACCESS_WIFI_STATE, INTERNET, ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION, ACCESS_NETWORK_STATE, and also remember that to scan Wi-Fi networks you must activate the location (google requirement).
installation:
pip3 install wifidroid
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file wifidroid-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: wifidroid-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.8.0 tqdm/4.51.0 CPython/3.9.0+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5717375902ea9db74f47ed5410ad811029ccb1e18a9fd61f5c1fc82d35008ee |
|
MD5 | b5c71ddffcfb1707ddeaafe08efd8a20 |
|
BLAKE2b-256 | c7a0ec442316e76633dca81b05975d0fadb27b93f88059fd1660982e7dae7218 |