0 votes
by (260 points)

How to dissconnect from current connected WIFI hotspot by code? I am using Pico G2 4K with Unity SDK, and helper library

I can edit and compile AndroidHelper library project and solution can be provided in java (I can't find suitable disconnect method in Unity Pvr_UnitySDKAPI).

I tried to use

WifiManager wifiManager = (WifiManager) mContext.getApplicationContext().getSystemService(WIFI_SERVICE);

...disable wifi java code...

for( WifiConfiguration wifiConfiguration : wifiConfigurationList) {

    Log.d(TAG, "clear id: " + wifiConfiguration.networkId + " ssid: " + wifiConfiguration.SSID);


 ...enable wifi java code...

and without wifiManager.disableNetwork(), and with wifiManager.saveConfiguration() after removing - results all the same

Problem: everytime device automatically reconnected to latest connected WIFI spot after this code. How to disconnect and "forget" network (clear password for SSID)?

There are no errors in logcat and I see last connected ssid is processed, Wifi disabling code is working ok, wifi enabling code is working ok, but password for this ssid is not clearing...

1 Answer

0 votes
by (55.5k points)

Dear Developers

Sorry, there is no function of "Disconnect network" or "Forget network" at present.
It can only be manually forgotten in Settings.