Restore Twitter Drafts from Android Backup

In this guide, I will show you how to restore your Twitter drafts from an android backup. You will need root access for this, as the database is stored in a protected area of the file system. If you don’t have root access, there are many tutorials on the Internet. Gaining root access is beyond the scope of this guide, as every device is different.


The Backup
For this guide, I will be using a backup that was made using adb (Android Backup). Depending on the method you used to backup, the process may be different. Essentially, we need to grab the Twitter drafts database. The location of the database is: /data/data/ The file we need will have drafts.db in the name. If you have multiple accounts, you will have multiple drafts.db files, you can use to identify the correct one. This is how to extract it using Android Backup Extractor

Screenshot 2015-02-09 15.39.24-First, you need to download Android Backup Extractor & extract it’s contents.
-Then run the following command in command prompt. (obviously you will need to change parameters to match your file locations):

java -jar abe.jar unpack NAME_OF_BACKUP.ab NAME_OF_BACKUP.tar

Screenshot 2015-02-09 14.20.36-This will then create a .tar file of your backup that can easily be extracted using 7zip or winrar.
-Once you extract the tar file, you can transfer the database to your device. The drafts database will be in /apps/<twitter-id>-drafts.db


Restoring Backup
Now this part is where it gets a bit tricky. We need to copy the drafts database to the phone & set permissions so the app can read/write to the database. To get the file on the device, you can transfer via an SD card or via the web. I uploaded mine to dropbox & downloaded on the device using the web browser. Once the file is on the device, you will need to replace the current drafts database with the backup. This can easily be done using File Explorer.

Screenshot_2015-02-09-14-26-57-Make sure twitter is installed & you have logged into your account.
-Install File Explorer & the Root Add-on on your device
-Using File Explorer, copy the drafts.db to /data/data/<twitter-id>-drafts.db
-This will overwrite your current drafts, so make a copy if you want it saved
Screenshot_2015-02-09-14-27-58 Screenshot_2015-02-09-14-27-07-Set the Owner & Group to the twitter app by tapping & holding on the drafts file & choose ‘Security’. This will enable the app to read & write to the database


Screenshot_2015-02-09-14-36-10Then you should be able to launch the twitter app & your drafts will be restored. And, I should have mentioned earlier… If you just want to view the drafts without restoring them, you can use DB Browser for SQLite to browse the drafts.db.



Leave a Reply