Skip to main content

imp.clearconfiguration(action)

Erases the network settings and credentials held by a device

Availability

Device

Parameters

Name Type Description
action Constant A value specifying the clearing action to be performed (default = all, from release 34)

Returns

Nothing

Description

This method deletes the network settings and credentials stored on the device on which it is called.

Calling imp.clearconfiguration() does not affect the current connection, only future connections. If a device is connected when this method is called, the device will not immediately and automatically disconnect, even if the stored WiFi network is cleared. It is possible that the device may stay connected for some time. However, as soon as it enters deep sleep, is power cycled or is disconnected manually by calling server.disconnect(), the connection will be broken, and when the device attempts to re-connect by WiFi (automatically or manually, according to circumstances) it will not be able to do so until network settings have been re-supplied.

You may choose to pass one of the following action constants to control the method’s behavior:

Constant Action
CONFIG_WIFI Clear any saved WiFi configuration information but retain enrollment data. This will also clear WiFi hints set with imp.net.setwifihints()
CONFIG_STATIC_NETWORK Clear any saved static network settings (see imp.setstaticnetworkconfiguration())
CONFIG_PROXY Clear any saved proxy server settings (see imp.setproxy())
CONFIG_ALL Clear all settings (default)

If no action constant is passed, all network settings, including WiFi network access credentials and device-enrollment data, will be cleared.

From impOS 42, including imp.clearconfiguration() or imp.clearconfiguration(CONFIG_ALL) in your code will also clear any list of preferred network interfaces you may have applied using imp.net.setserverinterfaces().