Did you knew why some of your apps require you to sign-in again after a factory reset (like banking apps) even if you restored the app with data using root access? Well, it’s because everytime you factory reset your device, and it’s set up as a new device with a new unique Android ID.
To avoid re-registering into apps because of your new Android ID, you could restore your old Android ID back. Titanium Backup has a neat function for this. However, with Android 6.0 Marshmallow you may not be able to restore/change your Android ID with Titanium backup or any other tools that worked with Lollipop and previous Android versions.
The reason Titanium Backup won’t work for you is because com.android.providers.settings cannot be backed up by a traditional SQLite database on Android 6.0 Marshmallow. Check out the detailed explanation for this by piit79 from XDA:
The Android ID backup/restore function is included in Titanium Backup. However, the Settings Storage (com.android.providers.settings) doesn’t seem to be backed by a traditional SQLite database in Android 6.0 Marshmallow – /data/data/com.android.providers.settings/databases/settings.db is empty (0 bytes) on my device. Therefore the Android ID cannot be restored/changed by the usual tools (including Titanium Backup).
Thankfully, piit79 found a way to query/update Settings Storage database using ADB. Below are the commands you need to run to restore/change your Android ID on Marshmallow:
- Setup ADB and Fastboot on your PC.
- Connect your Android device running on Marshmallow to PC and command window on the PC.
- Now issue the following command to get your current Android ID:
adb shell content query --uri content://settings/secure --where "name=\'android_id\'"
└ This will show you your current Android ID.
- Now issue the following command to change/update the Android ID to the one you want:
adb shell content update --uri content://settings/secure --bind value:s:<new_android_id> --where "name=\'android_id\'"
└ Replace text in red with your Android ID.
- That’s it. Verify if your Android ID has changed by using the command in 3rd Step.
If the above trick doesn’t work for you, then perhaps you’re better off deleting the current database record and re-insert it with your new Android ID. Use the two commands below for that:
adb shell content delete –uri content://settings/secure –where “name=\’android_id\'”
adb shell content insert –uri content://settings/secure –bind name:s:android_id –bind value:s:<new_android_id>
Note: Remember to replace the text in red with your unique Android ID.
All credits for the tip goes to piit79 from XDA, you can check his original post at XDA forums.
Happy Androiding!
Discussion