Migrate Android WiFi connections to another device
Whenever you connect to a WiFi network, your Android device will save the credentials so that you can connect to the same network again in the future.
This data is sent to Google's servers, but you have no way to retrieve it from the phone. If you do not activate phone backup on Google, the information will be lost if you change the device.
The WiFi settings (practically the SSID and the password for each connected network) are saved into a file. Depending on the Android version and the vendor, the file may have different name and location, here are some examples:
- /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml
- /data/misc/wifi/WifiConfigStore.xml
- /data/misc/wifi/wpa.conf
- /data/wifi/bcm_supp.conf
- /data/misc/wifi/wpa_supplicant.conf
Passwords can be stored in encrypted form or in plain text. To replace the file you need root privileges.
Here it is the procedure to replace the existing file with your backup:
- Turn off the WiFi on the device.
- Connect from the PC via the USB cable and the adb shell command.
- Became root with the su command.
- Take note of the ownership, permissions and security context of the file /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml (use the ls -lZ command).
- Replace the WifiConfigStore.xml file with the old one.
- Eventually restore ownership, permissions and security context of the file (use the chown and chcon commands).
- Reboot the device.