Detailed explanation of forget () operation example of Android WiFi

Detailed explanation of forget () operation example of Android WiFi

When dealing with a WiFi connection, we sometimes need to forget the password information of the current connection. To perform this operation, we need to call the WiFi Manager:: forget() function:

It can be seen from the function introduction that by calling the forget () function, the configuration information of the current network connection will be transferred from WPA_ Deleted from supplicant.conf; After that, the network will not be automatically reconnected, because there is no configuration information of the network in the conf file.

Trace forget_ Network message, WiFi serviceimpl:: clienthandler processing:

Simply forward the message to WiFi state machine. At this time, WiFi is connected, the current state in WiFi Statemachine is connectedstate, and its parent state connectmodestate processing:

mWifiConfigStore.forgetNetwork():

According to the incoming netid of the current network, call the removenetwork() and saveconfig() methods of WiFi native to delete the configuration information of the conf file and save it; When the execution is complete, the forget () function ends. Through the code, we found that executing the forget () function does not cause the state switching in WiFi state machine.

Thank you for reading, hope to help you, thank you for your support to this site!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>