Export and import of contacts in android

Hi all, :wave:

this is a bit about android but also about Linux (for the solution).
At least I hope there might be a solution to the problem. I haven´t tested it yet. :neutral_face:

It´s a funny thing about exporting and importing telephone contacts with my android phones.

Here´s the scenario:

I have 2 android smartphones at my disposal. Both are the same make and model: Samsung Galaxy A04s.

They reside pretty much apart from each other. I want both phones to access the same data base regarding my telephone contacts.

So in order to export my telephone contacts from phone A to phone B I did it this way:

I exported them from phone A as a .vcf file, which resulted in the fact they were in its download folder now.
Now I sent them via e-mail attachment to phone B. Here I imported them in phone B´s telephone application.
All went well and the data base was the same for both phones. :+1:

Well, in the meantime there were some new contacts available in phone A. So I exported them again and wanted to import them the same way as described before.

But this time it failed.

Phone B said there was an error when trying to import the .vcf file. I took a closer look at it and discovered there was something strange going on.

The size of the .vcf file which phone B received via e-mail attachment was too small. That must have triggered the error. :thinking:

The actual export on phone A went well: I checked it on my Linux Lite PC:

.rw-rw-r-- 2.5k rosika rosika 21 Jun 14:07 Kontakte_004.vcf.

As you can see the file size is 2.5k. Checking the filesize of the received attachment on phone B: It says: 1.49k. :astonished:
Well, it´s too small. Something went wrong during the transmission, it seems. But why?

I repeated the whole process twice and arrived at the exact same result. Once again: 1.49k in size. I cannot explain that.

So I was thinking:

Why not save the contents of Kontakte_004.vcf in a text file Kontakte_004.txt, send it to phone B, rename it there to Kontakte_004.vcf again
and import the contacts now?
Perhaps it´ll work this way.

I just did an experiment on my Linux Lite PC:

cat Kontakte_004.vcf > Kontakte_004.txt, which gave me the text file. Then I compared the 2 files:

file Kontakte_004.vcf Kontakte_004.txt 
Kontakte_004.vcf: vCard visiting card, version 2.1, lines not separated by CRLF
Kontakte_004.txt: vCard visiting card, version 2.1, lines not separated by CRLF

So both files are recognized as “vCard visiting card” despite their different file extensions. I guess Linux looks for the contents to verify that. Then:

diff -s  Kontakte_004.vcf Kontakte_004.txt 
Files Kontakte_004.vcf and Kontakte_004.txt are identical

So taking a shot at the method of sending a text file to phone B and then renaming the extension back to .vcf seems worth while…
… provided that the attachment as text file is not compromised (as it was with the vcf file). :thinking:

What do you think of it :question:

Thanks it advance and many greetings from Rosika :slightly_smiling_face:

2 Likes

The key question is, why was the .vcf file compromised.
I thought anything sent as an email attachment would be a perfect copy?
and
I thought there was some way to sync such things automatically?

2 Likes

Hi Neville, :wave:

thanks for your quick reply. I know it´s getting pretty late. :wink:

I was pondering about that as well.

The curious thing about it is: I repeated the export and the sending of the .vcf file twice and always arrived at the same result. So it was not a coincidence the first time.

Apart from this very scenario I never had any difficulties in sending e-mail attachments, neither with image files or otherwise.
So I thought perhaps sending a text file would be some kind of workaround.

Just a thought.

Cheers from Rosika :slightly_smiling_face:

1 Like

What about to comparing the original .vcf and the “compromised” one?

2 Likes

Hi László, :wave:

Good idea. Haven´t thought about that, I have to admit. :blush:

I just checked on my Linux Lite PC:
Actually it´s not compromised here at all: 2.5 kB. This is to verify that there´s nothing wrong with the e-mail provider or the e-mail clients involved(?)

I received the compromised .vcf file only on the smartphone. But there seems to be a system behind it, as 3 attempts resulted in the same behaviour.

To view the contents of of the .vcf file on the smartphone I´d have to take a look at it from there.
Not sure if (or how) it can be done. :thinking:

Thanks a lot, László.

Cheers from Rosika :slightly_smiling_face:

1 Like

I think if a .vcf file contained binary (eg a photo) email may scrsmble it , unless you somehow protect the binary.
The used to be a technique for sending binary files by email… i cant remember what we used to do… it was some sort of conversion to characters , sending, then back convert at the other end. A bit like encode and decode… but my memory fails me.

2 Likes

Use Termux in the phone.
Even better, if you had Termux in both phones, you could probably sftp it between them and avoid the email problem

2 Likes

Thanks, Neville, for providing some good advice, :heart:

I may “compress” it with 7zip and send it as an archive. No idea whether it´ll do any good, but it might be worth a shot.

Right. I missed the ovious thing. Dear me. :blush:

Thanks a lot and all the best from Rosika :slightly_smiling_face:

1 Like

Hi Rosika,
I don’t know the solution to your problem, but I’ve come up with the following which I don’t know if it’s useful to you, since the phones are Android.
Using a browser, you can access the Google contacts on your phone.

There, you can import and export contacts


Regarding your problem: does the Contacts apps have the same version?
I ask this because we have 2 phones that are exactly the same and the updates, especially system updates, usually have a few weeks difference: the update appears to be done on one phone and only after a while does the same update appear to be done on the other phone.

Jorge

3 Likes

I go with the answer of jorge.

If both are on android so by default on Google that will transfer automatic and merge.

A few years back I borrowed my girlfriends phone and merged my contacts into hers so I couod send a mail on her phone as mine was not working, empty battery.

A few days later she said who is Christine, i have no idea, well who is emma ?, no idea I replied … but they are in your contacts you imported …

Now married to my then girlfriend, I have deleted all these names and numbers from my phone and still have no idea who tyey were or why they were in my contacts but suspect they were clients at some stage.

Names changed to protect my innocence!

My phone book has 3 names in now no more, same with mail… :+1::ok_hand:

2 Likes

That’s how it works on my two phones. Wife and mine. His and Hers.

2 Likes

Not sure about 7zip.
You need to turn each byte into characters ( they usually user 2 hex digits) send the characters, then uncode it at the other end.
See uuencode
https://linux.die.net/man/1/uuencode

2 Likes

Hi all, :wave:

thanks a lot for your new input. I´m amazed at what you came up with. :wink:

I´m happy to say I solved the problem this morning. More on it later.

@Tech_JA :

Thank you for your recommendation, Jorge.
Clicking on the link you provided led me to Google´s sign-in page.
It said:

Use your Google Account

Haha, that´s funny. :laughing:
I don´t have a Google Account, and at the moment I´m not planning to create one.

Haven´t checked it yet, but I guess so.
Although on phone B there´s still an update pending. I´ll have to take care of that.

Thanks a lot, Jorge. :heart:

@callpaul.eu :

Thanks for sharing your personal experience.
It´s quite an interesting story.

@easyt50 :heart:

Thanks to you as well, Howard.

@nevj :

Well, it worked perfectly, Neville; just the way I intended it to. :+1:

Solution: see below.

Thanks also for the links.
Although the problem seems to be solved, I´ll take at look at those pages.
I´m always curious about things like that.

@ all:

Solution:

  • making use of 7zip
  • apt-cache show says: “7-Zip file archiver with a high compression ratio”
  • On my Linux Lite PC (where the correct file Kontakte_004.vcf) was residing I compressed and encrypted the file with file-roller using 7z.
  • see the difference in size:
ll Kontakte_004.vcf Kontakte.7z 
-rw-rw-r-- 1 rosika rosika 2.5K Jun 21 14:07 Kontakte_004.vcf
-rw-rw-r-- 1 rosika rosika  842 Jun 21 16:39 Kontakte.7z

  • I then sent Kontakte.7z via e-mail attachment to my 2nd e-mail address and downloaded in using phone B.
  • on phone B: I unpacked and decrypted the file with 7z using termux.
  • I immediately relized that the decrypted .vcf file had a size of 2.5K again, which looked very promising :wink:
  • now I could import the contacts on thone B without any hiccups

So packing/compressing the .vcf file did the trick.
This file apparently couldn´t be tempered with during the transmission of the e-mail and everything went smoothly.

Of course it would be interesting to see what the corrupted file looked like, as László @kovacslt already suggested.

Unfortunalely I had sent it to the trash can before doing my latest (and successful) experiment.
I might me able to restore it; I don´t know.
I´ll look at it tomorrow.

Thank you so much to all of you for your kind help. :heart:

Many greetings from Rosika :slightly_smiling_face:

3 Likes

hi Rosika,
Great solution.
uuencode is really old stuff. I thought it might help you grasp what is wrong.
Looks like 7zip deals with it… probably in a better way.
If 7zip works, tar would probably work too, but why bother, you have a solution.

Regards
Neville

3 Likes

Hi Neville, :wave:

thanks for the feedback. :heart:

I´ll still look into uuencode, just to learn something new. :wink:

In actual fact I was thinking about tar too. I´m sure it would´ve helped me arrive at the same result.

But, as you said, 7zip deals with the problem quite effectively, and I already have it installed.

Thanks again and many greetings from Rosika :slightly_smiling_face:

3 Likes

Hi László, :wave:

I finally managed to restore the .vcf file which was compromised when I first sent it as an (unencrypted/unzipped) attachment to my smartphone from the trash can.

I sent it back to my Linux Lite PC. This time I let it undergo the 7zip procedure to make sure no further damage would be done to it.

Now I could compare the original .vcf and the “compromised” one. :wink:

The uncompromised one would look like this:

 File: Kontakte_004.vcf
───────┼─────────────────────────────────────────────────────────────────────────────────────
   1   │ BEGIN:VCARD
   2   │ VERSION:2.1
   3   │ N:Neu;Smartphone;;;
   4   │ FN:Smartphone Neu
   5   │ TEL;CELL
[...]

everything´s correct here.

And this is what the compromised .vcf looks like:

That´s the extent of it. No wonder this file is smaller than the correct one. :wink:

Well, one thing I learned:
When attaching a .vcf file to an e-mail better encrypt/zip/pack it first.
At least in my case this prevented the file from getting corrupted.

Many greetings from Rosika :slightly_smiling_face:

2 Likes

It is binary. I dont understand how that happened?
Maybe some byte code was interpreted as a modifier.

2 Likes

Thanks, Neville, for the evalualtion of what had happened. :heart:

So we know what occurred but now how and why. :thinking:
The curious thing about it is: I performed the exact same action twice and the result was the same.
So it was no coincidence the first time it happened.

Well - as I said - 7zip took care of that glitch.
I have to remember that in the future. :wink:

Many greetings from Rosika :slightly_smiling_face:

P.S.:

So something would´ve actively accessed the attachment?
I don´t like that.

1 Like

Email is really only suited to sending text… even as an attachment… ie only ascii codes that correspond to characters.
If you send a byte that corresponds to BEL, or ACK, or any of the control codes, it may do something to the content.

2 Likes

Ah, I see, Neville.

Thank you very much for the background info. You know a great deal about things like that. :+1:

I guess that must be the explanation.

O.K. That´s settled then.

Thanks again and many greetings from Rosika :slightly_smiling_face:

2 Likes