Recently, I decided to migrate from iOS to Graphene. Since everyone around me uses WhatsApp and I have chats that I don't want to lose, I decided to spend a few hours figuring out the best way to migrate chats from one OS to another.

I will provide some context before diving into the topic. iOS has a way to migrate chats from an iPhone to an Android device (GrapheneOS doesn't work; it has to be an Android device), so I decided to start here.

In my case, I don't have another mobile device with Android, so I used the Pixel to capture a copy of the iOS backup on Android. If you are starting from an Android device, you can skip directly to step 2.

Note 1: Stickers will not be transferred, but there will be a copy of all the sent stickers in the chats. I will later explain how I managed to recover the stickers if needed.

1. I started by following this guide: https://support.google.com/android/answer/14669513?hl=en&co=GENIE.Platform%3DiOS. It basically explains how to transfer the app from iOS to an Android device. In my case, I only imported the WhatsApp app and nothing else. I followed the guide to bring all the chats and restore the backup.

2. At this point, the Android device should have a copy just like it was on iOS. Now we will make a copy, but we will not use the Google Drive cloud backup. Instead, we will make a local copy on our PC to later recover it on the device where we have installed GrapheneOS.

Note 2: The Windows file explorer doesn't work very well when transferring many files. It freezes and doesn't transfer the information. To avoid using this method, we can use the adb tools (https://developer.android.com/studio/releases/platform-tools).

Activate developer mode in Settings > About phone and click on the build number until they are activated. Next, enable USB debugging in Settings > System > Developer options.

3. Connect the Android device to the PC with the USB cable and use the adb tools to transfer the files to the PC. In my case, I used these commands to transfer the files:

.\adb.exe pull /sdcard/Android/media/com.whatsapp C:\Whatsapp_Backup\com.whatsapp
.\adb.exe pull "/sdcard/Android/media/com.whatsapp/WhatsApp Images" "C:\Whatsapp_Backup\WhatsApp Images"
.\adb.exe pull "/sdcard/Android/media/com.whatsapp/WhatsApp Stickers" "C:\Whatsapp_Backup\WhatsApp Stickers"
.\adb.exe pull "/sdcard/Android/media/com.whatsapp/WhatsApp Video" "C:\Whatsapp_Backup\WhatsApp Video"

Note 3: I recommend doing it step by step, as you can miss some folders in the transfer and not notice it. In my case, I had to isolate those three folders at the root of C:\Whatsapp_Backup and import them one by one later. I will leave you the commands I used as an example:

The folder structure is as follows:

C:\Whatsapp_Backup\com.whatsapp
C:\Whatsapp_Backup\WhatsApp Images
C:\Whatsapp_Backup\WhatsApp Stickers
C:\Whatsapp_Backup\WhatsApp Video

So the commands to transfer were:

.\adb.exe push C:\Whatsapp_Backup\com.whatsapp /sdcard/Android/media/
.\adb.exe push "C:\Whatsapp_Backup\WhatsApp Images" "/sdcard/Android/media/com.whatsapp/WhatsApp/Media"
.\adb.exe push "C:\Whatsapp_Backup\WhatsApp Stickers" "/sdcard/Android/media/com.whatsapp/WhatsApp/Media"
.\adb.exe push "C:\Whatsapp_Backup\WhatsApp Video" "/sdcard/Android/media/com.whatsapp/WhatsApp/Media"

As I mentioned earlier, I was forced to do it this way due to the absurd amount of files in those folders. You can try to do it all with the first command without moving the folders out of "com.whatsapp," but it didn't work for me because of the file volume.

4. Once we have the WhatsApp copy on the mobile device, we can install WhatsApp. In my case, I used Aurora Store, logged in with my mobile phone, and after granting permissions to the app, it should detect that you have a backup to restore. Click on restore, and you will have your backup restored.

Extra. To recover stickers, I simply took a copy of the WhatsApp Stickers folder and used this application (https://github.com/qarmin/czkawka) to delete all duplicates (note that it stores all the stickers sent in the chats. In my case, I had 19600, so I used this app to speed up the inhuman task of doing it manually). I uploaded the remaining stickers to a folder on my mobile device and restored the ones I wanted with the "Sticker Maker" app.

    Great job, thank you very much for sharing it in such detail. It can help a lot of people.

    I assume this procedure is for Whatsapp installed in the main owner profile.
    Would this be much different for Whatsapp under a secundary profile?

    • Kai1 replied to this.

      Kai1

      Thanks for this excellent breakdown.

      Thank you for this guide. I had a similar situation (old Samsung with normal Android to new Pixel with GrapheneOS) but it didn't work by just copying the files in /Android/media/com.whatsapp/. It didn't offer me to restore the files. I suspected this is because it didn't know how to decrypt them but no idea what was the real reason.

      In the end I was able to use the built-in transfer from one to another Android phone. This is a Whatsapp feature but you need to have two phones so it wouldn't have worked in your case.

      I also wonder if it would be possible to do a Google Drive backup (I think you can enable end-to-end encryption in the settings) on the old phone, install Play Services on GrapheneOS and download the backup from Google Drive, and then stop any further cloud backups and remove Play Services again. As Play Services are a normal, sandboxed app like any other on GrapheneOS, there should be no trace of the Google account left on the phone afterwards, right?

        Stephan-P Each profile has its own folders, so I asume you can do it in other profile too, since you have to import the com.whatsapp folder to your device before install the APP.

        • Edited

        Kai1

        I've noticed now, there's a mistake at step 3.

        Instead of:

        .\adb.exe pull /sdcard/Android/media/com.whatsapp C:\Whatsapp_Backup\com.whatsapp
        .\adb.exe pull "/sdcard/Android/media/com.whatsapp/WhatsApp Images" "C:\Whatsapp_Backup\WhatsApp Images"
        .\adb.exe pull "/sdcard/Android/media/com.whatsapp/WhatsApp Stickers" "C:\Whatsapp_Backup\WhatsApp Stickers"
        .\adb.exe pull "/sdcard/Android/media/com.whatsapp/WhatsApp Video" "C:\Whatsapp_Backup\WhatsApp Video"

        We have to import in "C:\Whatsapp_Backup" only once:

        .\adb.exe pull /sdcard/Android/media/com.whatsapp C:\Whatsapp_Backup

        Note: If you have any issue trying to import all at once, you can pull folder by folder if needed.

        Sorry for the mistake, I can't edit the original post so I explain it here.

        6 days later

        Hello, I'm trying to do exactly this thing with my iPhone 12 but when it comes to copy the apps it seems to process something for about 20-30 minutes but in the end it skips the step and went to Google Pay setup and all that stuff. Have someone experienced this problem? Could it be that I haven't done this part when I restored the stock Android?
        Thank you in advance for the help.

          Player5260
          Edit: Sorry just a little update, I managed to erase the key but I have the same behaviour, it seems to backup data but at the end it does all the steps but not the one about the apps.

          WhatsApp has a (new, I think) feature.
          Settings > chat > transfer chats
          Opens a screen that says:

          Transfer chat history to Android phone
          Transfer your chat history privately and have your most up-to-date messages without using Google storage. Certain device permissions are needed to connect to your new device

          I had never seen this before. Maybe it's new, maybe not. Perhaps it only shows because I downloaded the ungoogled apk from their site.

          Can you check if iOS WhatsApp has this?

          • Kai1 replied to this.
            11 days later

            Hb1hf

            Yes, it has it, that's how I managed to move chats from iOS to other Android and get the com.whatsapp folder.

            Viewpoint0232 I had the same issue: I was transferring the backup from an old phone (with Android 9) to a Pixel with GOS, and it didn't want to recognize the backup. I've written extensively about it here.

            it didn't work by just copying the files in /Android/media/com.whatsapp/. It didn't offer me to restore the files.

            That's the same problem I faced. I suspect that's because of how the file system works and the changes that were made from Android 10 onward (file-based encryption, etc.), but other messaging apps that had a local backup allowed me to transfer all the encrypted messages and the media flawlessly, so I assume that the programmer at Facebook/Whatsapp are a bunch of retards that don't know how to make even the most basic stuff work (also, have you looked at how outrageous some whatsapp functionalities are? Only disabled persons could come up with such poorly thought solutions).
            Also, it's specified on the official WA website that from Android 10 onward they don't support the manual transfer of backups (really? the most straight-forward and flawless mode of backup is disabled by those douchebags at facebook...). So I can't understand the part where you say

            I suspected this is because it didn't know how to decrypt them but no idea what was the real reason.

            What's there to decrypt? Where would you specify a decryption key in the WA backup database, apart from the app itself when doing said backup?

            In the end I was able to use the built-in transfer from one to another Android phone.

            As also stated in my linked post, the chat transfer function did not work for me, because it is such a poor implementation that a toddler would know how to do that better, and does not work when the backup is too large or contains a lot o media.

            I also wonder if it would be possible to do a Google Drive backup

            Yes, that's the option that worked for me. And sadly, as many thing in our era, it's the most invasive and least secure and privacy-friendly.
            I installed the play services and given them the minimal amount of permissions necessary. See my linked post for details, but it's a straightforward method: create a throw-away anonymous Google account, connect it on the old device, do the encrypted backup, then specify it on the new WA on GOS upon launching the app for the first time, and restore it. Then nuke everything, from the backup to the account itself (if you plan on not using it ever again, like me).
            And after you nuke the account and uninstall all the Google spyware (services & store) the is no trace of it left, because thanks to the GOS developers all the apps are sand-boxed, and Big G does not have any privileged access to your phone, and no files remain after the uninstall (apart maybe for some temporary files). Also, WA's notification (even calls) function perfectly without google services, because they (apparently) have a double implementation, through google firebase and through their proprietary servers, and it switches automatically between them.

              • [deleted]

              Viewpoint0232 you can choose to keep app data on uninstallation. I hope this helps.

              • [deleted]

              ToffoliGate there is a double implementation for notifications, but if you had previously used Google Play Services, it will (after uninstallation) remember and prefer that link and it will keep stopping in the background even with unrestricted battery use, resulting in untimely notifications or only upon restart of the app as I came to find out multiple times. Removing the app, while keeping data and restoring from WhatsApp site + granting unrestricted battery use will resume its functionality.