Skip to content

Commit 2985c14

Browse files
committed
doc: update readme document
1 parent bd74f2c commit 2985c14

File tree

1 file changed

+89
-91
lines changed

1 file changed

+89
-91
lines changed

README.md

Lines changed: 89 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,48 @@
1-
# Wifi Manager for .NET MAUI
1+
# Wi-Fi Manager for .NET MAUI
22

3-
Welcome to the documentation for the MAUI Wi-Fi Manager library, a comprehensive solution designed specifically for MAUI. This library empowers developers to effortlessly manage Wi-Fi networks within their cross-platform applications. With its intuitive APIs, you can seamlessly integrate Wi-Fi functionality, allowing users to connect to, add, and retrieve information about Wi-Fi networks with ease.
3+
The Wi-Fi Manager for .NET MAUI is a simple and powerful library that helps you manage Wi-Fi networks in your cross-platform apps. With this library, you can easily connect to Wi-Fi networks, retrieve network information, and provide quick access to Wi-Fi and wireless settings.
44

55
[![WifiManager.Maui](https://img.shields.io/nuget/v/WifiManager.Maui)](https://www.nuget.org/packages/WifiManager.Maui/)
66

7+
---
78

8-
## Platform Support
9+
## Supported Platforms
910

10-
| S. No. | Platform | Support | Remarks |
11-
| ------ | ------------ | --------- | ----------- |
12-
| 1. | Android | ☑ | |
13-
| 2. | iOS | ☑ | |
14-
| 3. | Windows | ☑ | |
15-
| 4. | Mac | ☒ | Coming Soon |
16-
| 5. | Tizen | ☒ | Coming Soon |
11+
| Platform | Supported | Notes |
12+
|-----------|-----------|----------------------------------|
13+
| Android | | |
14+
| iOS | | |
15+
| Windows | | |
16+
| Mac | | |
17+
| Tizen | | |
1718

18-
## Features
19+
---
1920

20-
- Connect Wi-Fi with SSID and Password: Enable users to connect to Wi-Fi networks by providing the SSID and password.
21-
- Add a New Wi-Fi Network: Seamlessly add new Wi-Fi networks to the device.
22-
- Get Current Network Info: Retrieve information about the currently connected Wi-Fi network.
23-
- Disconnect Wi-Fi: Allow users to disconnect from a Wi-Fi network.
24-
- Open Wi-Fi Setting: Provide a quick way for users to access their device's Wi-Fi settings.
21+
## Key Features
2522

26-
## Getting started
23+
- **Connect to Wi-Fi**: Connect to Wi-Fi networks using SSID and password.
24+
- **Get Network Info**: View details about the currently connected network.
25+
- **Disconnect Wi-Fi**: Disconnect from a specific Wi-Fi network.
26+
- **Open Wi-Fi Settings**: Provide quick access to device Wi-Fi settings.
27+
- **Open Wireless Settings**: Provide quick access to device wireless settings.
28+
29+
---
30+
31+
## How to Get Started
2732

2833
### Initialization
2934

30-
Before using the MAUI Wi-Fi Manager plugin in your application, it's essential to initialize it. Here's how to do it on different platforms:
35+
Before using the library, make sure to initialize it properly:
3136

32-
#### Android
37+
#### For Android
3338

34-
To use the MAUI Wi-Fi Manager on Android, you must initialize the plugin. Add the following code to your Android application:
39+
Add the following to your Android app initialization:
3540

3641
```csharp
37-
WifiNetworkService.Init(this);
42+
WifiNetworkService.Init(this);
3843
```
3944

40-
Android Permissions
45+
Also, include these permissions in your `AndroidManifest.xml` file:
4146

4247
```xml
4348
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
@@ -48,120 +53,113 @@ Android Permissions
4853
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
4954
```
5055

51-
Make sure you request location before scanning Wi-Fi
56+
Make sure to request location permissions before scanning for Wi-Fi.
5257

53-
#### iOS
58+
#### For iOS
5459

55-
Add wifi-info and HotspotConfiguration in Entitlements.plist
60+
Add the following to your `Entitlements.plist`:
5661

5762
```xml
58-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
59-
<plist version="1.0">
60-
<dict>
61-
<key>com.apple.developer.networking.wifi-info</key>
62-
<true/>
63-
<key>com.apple.developer.networking.HotspotConfiguration</key>
64-
<true/>
65-
</dict>
66-
</plist>
63+
<key>com.apple.developer.networking.wifi-info</key>
64+
<true/>
65+
<key>com.apple.developer.networking.HotspotConfiguration</key>
66+
<true/>
6767
```
6868

69-
Request location permission on info.plist
69+
In `Info.plist`, request location permissions:
7070

7171
```xml
7272
<key>NSLocationWhenInUseUsageDescription</key>
73-
<string>App want to access location to get ssid</string>
73+
<string>The app needs location access to detect Wi-Fi networks.</string>
7474
```
7575

76-
Example
76+
---
7777

78-
```csharp
79-
PermissionStatus status = await Permissions.RequestAsync<Permissions.LocationWhenInUse>();
80-
if (status == PermissionStatus.Granted)
81-
{
82-
var response = await CrossWifiManager.Current.ScanWifiNetworks();
83-
}
84-
else
85-
await DisplayAlert("No location permission", "Please provide location permission", "OK");
86-
```
78+
## Examples
8779

88-
#### Connect to Wi-Fi
80+
### Connect to Wi-Fi
8981

90-
To connect to a Wi-Fi network programmatically, use the ConnectWifi method. This method takes the SSID and password as parameters. Here's an example:
82+
To connect to a Wi-Fi network:
9183

9284
```csharp
93-
var response = await CrossWifiManager.Current.ConnectWifi(ssid, password);
85+
var response = await CrossWifiManager.Current.ConnectWifi("your-SSID", "your-password");
9486
```
9587

96-
The NetworkData class is defined as follows:
88+
---
89+
90+
### Scan for Available Networks
91+
92+
To get a list of available Wi-Fi networks (Android & Windows only):
9793

9894
```csharp
99-
public class NetworkData
100-
{
101-
public int StausId { get; set; }
102-
public string Ssid { get; set; }
103-
public int IpAddress { get; set; }
104-
public string GatewayAddress { get; set; }
105-
public object NativeObject { get; set; }
106-
public object Bssid { get; set; }
107-
public object SignalStrength { get; set; }
108-
}
95+
var response = await CrossWifiManager.Current.ScanWifiNetworks();
10996
```
11097

111-
#### Scan available Wi-Fi (Not available on iOS)
98+
---
11299

113-
You can access available Wi-Fi networks using the ScanWifiNetworks method (Available on Android & Windows):
100+
### Get Current Network Info
101+
102+
To retrieve details of the currently connected Wi-Fi network:
114103

115104
```csharp
116-
var response = await CrossWifiManager.Current.ScanWifiNetworks();
105+
var response = await CrossWifiManager.Current.GetNetworkInfo();
117106
```
118107

119-
#### Get Wi-Fi info
108+
---
109+
110+
### Disconnect Wi-Fi
120111

121-
You can retrieve information about the currently connected Wi-Fi network using the GetNetworkInfo method:
112+
To disconnect from a Wi-Fi network:
122113

123114
```csharp
124-
var response = await CrossWifiManager.Current.GetNetworkInfo();
115+
await CrossWifiManager.Current.DisconnectWifi("your-SSID");
125116
```
126117

127-
#### Disconnect Wi-Fi
118+
---
128119

129-
To disconnect from a Wi-Fi network, simply call the DisconnectWifi method with the SSID as a parameter:
120+
### Open Wireless Settings
121+
122+
To open the device's wireless settings:
130123

131124
```csharp
132-
CrossWifiManager.Current.DisconnectWifi(ssid);
125+
await CrossWifiManager.Current.OpenWirelessSetting();
133126
```
134127

135-
#### Open Wi-Fi Setting
128+
**Note**: On iOS, this opens the app's settings instead of wireless settings.
129+
130+
---
136131

137-
If you want to provide users with a convenient way to access their device's Wi-Fi settings, use the OpenWifiSetting method:
132+
### Open Wi-Fi Settings
133+
134+
To provide quick access to Wi-Fi settings:
138135

139136
```csharp
140-
var response = await CrossWifiManager.Current.OpenWifiSetting();
137+
await CrossWifiManager.Current.OpenWifiSetting();
141138
```
142139

143-
I value your feedback! If you encounter any issues, have suggestions for improvement, or wish to report bugs, please open an issue on GitHub or GitLab repository
140+
**Note**: On iOS, this opens the app's settings instead of Wi-Fi settings.
144141

145-
## License
142+
---
146143

147-
MIT License
144+
## Feature Support by Platform
148145

149-
Copyright (c) 2023 Santosh Dahal
146+
| Feature | Android | iOS | Windows | Notes |
147+
|----------------------------------|---------|-----------|---------|-----------------------------------------|
148+
| Connect to Wi-Fi |||| Supported on all platforms. |
149+
| Get Current Network Info |||| Supported on all platforms. |
150+
| Disconnect Wi-Fi |||| Supported on all platforms. |
151+
| Scan for Available Wi-Fi Networks|||| Not supported on iOS. |
152+
| Open Wireless Settings ||* || *Opens app settings on iOS. |
153+
| Open Wi-Fi Settings ||* || *Opens app settings on iOS. |
150154

151-
Permission is hereby granted, free of charge, to any person obtaining a copy
152-
of this software and associated documentation files (the "Software"), to deal
153-
in the Software without restriction, including without limitation the rights
154-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
155-
copies of the Software, and to permit persons to whom the Software is
156-
furnished to do so, subject to the following conditions:
155+
---
157156

158-
The above copyright notice and this permission notice shall be included in all
159-
copies or substantial portions of the Software.
157+
## Feedback & Issues
158+
159+
If you encounter any issues or have suggestions, please open an issue on the project's GitHub or GitLab repository.
160+
161+
---
162+
163+
## License
160164

161-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
162-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
163-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
164-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
165-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
166-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
167-
SOFTWARE.
165+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

0 commit comments

Comments
 (0)