How to migrate contacts2.db between android devices (SELinux enabled)? I exported a contacts2.db from a samsung s6 and try to import it to a Samsung S2 tab. both phones operate on android 6 and are rooted. What I've achieved so far:


I managed to copy the file from the source device with:


adb shell "su -c cat /path/to/contacts2.db" &gt; contacts2.db


I managed to restore the database by copying the file to the sdcard of the destination device and then via adb shell


su
cd /data/data/com.android.contacts/databases/
mv contacts2.db contacts2.db.bak
cp /sdcard/contacts2.db .
chown  u0_a4:u0_a4 contacts2.db
chmod 600 contacts2.db
cd ..
restorecon -Rv databases
kill $(ps | grep contacts | awk '{ print $2 }')



Then I start contacts again via gui, rebooted, but the contacts do not show up. It does not seem to be a file permission error, but a database problem? The devices run the same samsung stock firmware.


What did I miss here?
Contacts are stored in data/data/com.android.providers.contacts/databases. 

If you simply want to sync contacts in new phone, add same Google account on newer phone. It will automatically sync in background. 

You can also try Samsung SmartSwitch.