Skip to content

Instantly share code, notes, and snippets.

@proxium
Last active May 1, 2024 12:23
Show Gist options
  • Save proxium/ee76c9a599a55e6d50b31e8159f66b39 to your computer and use it in GitHub Desktop.
Save proxium/ee76c9a599a55e6d50b31e8159f66b39 to your computer and use it in GitHub Desktop.
How do I transfer WhatsApp from Android to iOS without phone rooting? [verified method 24-Oct-2020]

Initially based on https://github.com/residentsummer/watoi

Migrate Whatsapp chats history from Android to iOS.

Caveats

Media files and shared locations are not imported (got placeholders instead)

Messages from contacts that changed ids (phone numbers) are not linked

Prerequisites

  • Mac with installed Xcode and iTunes
  • Decrypted msgstore.db from Android
  • Installed and activated Whatsapp on your iDevice
  • Whatsapp.ipa of the same version (google will help)

How to get WhatsApp database decrypted from Android without Root

Based on this solution: https://www.quora.com/How-do-I-get-a-WhatsApp-key-file-without-rooting/answer/Vipul-Rajput-20

Prerequisites:

  • A windows ( Vista,7, 8 or 10) workstation
  • A mobile phone with Android version 4.0 or higher (used Honor 7/Android 6)
  • WhatsApp application version that create backup files with crypt6 / crypt7 / crypt8 or crypt12 encryption. External SD card is not necessary

Step by step guide:

  • Step 1: Download Java, I used OpenJdk 8 from jdk.java.net to avoid Oracle website registration

  • Step 2: Extract zip folder to your hard drive and create %JAVA_HOME% Environment Variable (follow this tutorial: https://javatutorial.net/set-java-home-windows-10)

  • Step 3: Install Android Debug Bridge (ADB) Drivers. The easiest way is to install it from this thread https://forum.xda-developers.com/showpost.php?p=48915118 (I tested v1.4.3)

  • Step 4: On your mobile phone, turn on the USB Debugging mode found in Developers Options.

  • Step 5: Download & extract (WhatsAppKeyExtract.zip https://github.com/EliteAndroidApps/WhatsApp-Key-DB-Extractor/archive/master.zip) on your computer, maintaining the directory structure. Extract it to your desktop would be fairly fine.

  • Step 5-1: (IMPORTANT) The script WhatsAppKeyExtract.bat will fail to download WhatsApp-2.11.431.apk, that's why you have to download the APK file manually (I downloaded WhatsApp 2.11.414 from https://apkmirror.com)

  • Step 5-2: Copy the downloaded APK file to WhatsApp-Key-DB-Extractor-master/tmp and rename it to LegacyWhatsApp.apk

  • Step 6: Connect your mobile device to your workstation. Wait until all necessary drivers are installed. Make sure all drivers are installed. Failing at this point will causes your mobile phone not detected by WhatsAppKeyExtract.bat.

  • Step 7: Unlock your mobile phone screen saver (if any) and wait for “Full backup” to be displayed on the screen of the device.

  • Step 8: Leave the password field blank and click on “Back up my data”. Wait a bit until WhatsAppKeyExtract window says “Done!”.

  • Step 9: Browse inside the WhatsAppKeyExtract folder, find a folder called extracted.

  • Step 10: Inside the extracted folder, you will find 3 generated files

    Key.db – the key!
    Msgstore.db – decrypted whatsapp backup (that we will use for the restored WhatsApp on iPhone)
    Wa.db – contacts

Convert to iOS format

Follow this guide: https://github.com/tyt2y3/watoi#2-convert-to-ios-format

Important

For older WhatsApp version use this command:

  • Backup original database and run the migration:
cp ChatStorage.sqlite ~/Documents/SafePlace/
build/Release/watoi <path-to-msgstore.db> ChatStorage.sqlite app/Payload/WhatsApp.app/WhatsAppChat.momd
  • In newer version from 2018:
cp ChatStorage.sqlite ~/Documents/SafePlace/
build/Release/watoi <path-to-msgstore.db> ChatStorage.sqlite app/Payload/WhatsApp.app/Frameworks/Core.framework/WhatsAppChat.momd

Conclusion

I decided to write down those steps so I don't spend much time (took me around 12H) trying to figure out all the steps.

When you activate your WhatsApp on iDevice, try to send some messages to your frequent chat groups/persons (I did it before inserting my SIM card). This will help you to restore migrate your chat history successfully after restoring the backup with iTunes (Windows or Mac).

When you give permission to WhatsApp to read your contact list (from Google or SIM card), the chat history will appear automatically with all your previous contacts.

Do not forget to backup then your WhatsApp to iCloud so you don't run any script to restore them back!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment