# WiFi Setup

**URL:** https://forum.magicleap.cloud/t/wifi-setup/5104
**Category:** General
**Tags:** settings
**Created:** [January 28, 2025, 9:30pm UTC](https://forum.magicleap.cloud/t/wifi-setup/5104 "2025-01-28T21:30:18Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![wrichey](https://avatars.discourse-cdn.com/v4/letter/w/c37758/32.png) [@wrichey](https://forum.magicleap.cloud/u/wrichey)
#### Post date: [January 28, 2025, 9:30pm UTC](https://forum.magicleap.cloud/t/wifi-setup/5104/1 "2025-01-28T21:30:18Z")

</div>

I would like to configure multiple devices to connect to the same Wi-Fi network without having to type the password for each one (and ideally, without needing that wifi network present at the time of device setup). I know that I can do this with an MDM but paying a monthly fee is not worth it for this service alone.

Is there a way to setup a ML2 to connect to a known wifi network without using an MDM or typing a password manually?

Edit to add: I've made a QR code, and if the device is in range of my network, i can use the QR code instead of typing manually, but it would be great if I could also configure with a QR code for a network that's not present.

---

<div class="post-metadata">

### Author: ![jakob.greuel](https://avatars.discourse-cdn.com/v4/letter/j/bbce88/32.png) [@jakob.greuel](https://forum.magicleap.cloud/u/jakob.greuel)
#### Post date: [January 29, 2025, 1:05pm UTC](https://forum.magicleap.cloud/t/wifi-setup/5104/2 "2025-01-29T13:05:39Z")

</div>

I sadly don't have a solution for you, but here is what i tried already:  
You can add the Wifi using WifiNetworkSuggestion, but there is [no notification for the user](https://forum.magicleap.cloud/t/issues-with-wifi-suggestion-android-api/2213) to confirm the connection so it has no real effect.

You can connect to the wifi by creating a NetworkRequest, which works in that the user gets a popup and the ML2 connects while the app is open, however i had no sucess in sending/recieving anything on the network/internet.

> **Code For NetworkRequest**
>
> ```auto
> private static ConnectivityManager connectivityManager = null;
> ...
> {
> connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
> NetworkRequest.Builder builder = new NetworkRequest.Builder();
> builder.addTransportType(NetworkCapabilities.TRANSPORT_WIFI);
> WifiNetworkSpecifier wifiNetworkSpecifier = getWifiNetworkSpecifier(ssid, password);
> builder.setNetworkSpecifier(wifiNetworkSpecifier);
> NetworkRequest networkRequest = builder.build();
> 
> RegisterCallback();
> 
> connectivityManager.requestNetwork(networkRequest, callback);
> }
> 
> ```
> 
> ```auto
> private static void RegisterCallback() {
> callback = new ConnectivityManager.NetworkCallback() {
> @Override
> public void onAvailable(Network network) {
> super.onAvailable(network);
> connectivityManager.bindProcessToNetwork(network);
> Log.d("NetworkManager", "WiFi connected");
> }
> 
> @Override
> public void onUnavailable() {
> super.onUnavailable();
> Log.d("NetworkManager", "Wifi not Available: ");
> connectivityManager.bindProcessToNetwork(null);
> }
> };
> }
> 
> ```

---

<div class="post-metadata">

### Author: ![SmiledPenguin47](https://avatars.discourse-cdn.com/v4/letter/s/b487fb/32.png) [@SmiledPenguin47](https://forum.magicleap.cloud/u/SmiledPenguin47)
#### Post date: [January 29, 2025, 4:43pm UTC](https://forum.magicleap.cloud/t/wifi-setup/5104/3 "2025-01-29T16:43:03Z")

</div>

I think the API might be specific to using Wifi Direct and not the network directly. I created a small script a while back that I vaguely remember working.

I found it helpful to test using an Android 10, x86\_64 virtual device without google play services in Android Studio to test.

* * *

Make sure to specify the following permissions in your apps manifest and set the API level to 29

```auto
  <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
  <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
  <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
  <uses-permission android:name="android.permission.WRITE_SETTINGS" />
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  <uses-permission android:name="android.permission.INTERNET" />

```

Put the `WifiConnector.kt` script into your project's plugins folder and put the `WifiManager.cs` script on a game object in your scene called WifiManager

[Wifi Connection Scripts.zip](https://forum.magicleap.cloud/uploads/short-url/iWWOmJNANeXWp25PYdUGvcM20s6.zip) (3.8 KB)

---

<div class="post-metadata">

### Author: ![Derkotraniti](https://avatars.discourse-cdn.com/v4/letter/d/e5b9ba/32.png) [@Derkotraniti](https://forum.magicleap.cloud/u/Derkotraniti)
#### Post date: [September 14, 2025, 7:23pm UTC](https://forum.magicleap.cloud/t/wifi-setup/5104/4 "2025-09-14T19:23:03Z")

</div>

What about certificate based authentication to your WiFi is it supported by ML2?
