I’m working on a program that allows users to cycle through a variety of contacts in a list viewer. Once a user finds a contact that they want to establish a business relationship with, I want them to be able to export the contact to a vcard (vcf) file so that they can place the contact in their actual phone address book. Has anyone else done something like this? I’ve looked in the forum by I don’t see anything on this topic. I’m looking for a suggestion about how to do this. I have the format of the final file. I just don’t know how to get the info out of the app and into the file.
Attempt #1: For a web app, you could include the VCF file as an app asset and open it with the web viewer. That causes chrome to download it. However, this approach doesn’t work in Thunkable Live on iPhone. You get the raw text in the Web Viewer screen instead - not useful. I don’t know about Android - I’ve just plugged my Kindle in to charge, so can update later. (UPDATE: At least on Kindle/Thunkable Live, it is completely unresponsive to being told to open link a .vcf file. Definitely go on to attempt #2)
Attempt #2: A better option might be this: Get the .vcf files on the internet somewhere. Then you can open them like this:
That causes the native contacts manager in iPhone to open the contact, and I can click ‘add contact’ at the bottom. It also triggers a download on the web app viewer. It works on Kindle (Android) as well.
I think option #2 is your solution. You just need to find some webspace to park your VCFs on.
I understood it that he/she wants to create a .vcf file from the selected contact in the list viewer (with other details such as phone number) and then export it to the phone. I must have completely understand the issue in a wrong way.
I was thinking of developing functions in Thunkable to generate the file structure of .vcf file and then use a JavaScript script to save it. Good I did not start coding it.
I do a lot of JavaScript codes but for this exact requirement, the Google sheet Marcos works better and can give the user a dialogue of where to save the file.
Muneer, you are correct. I do want to be able to export directly from the labels to a vcf file. That way I can make changes to the list and create a new vfc file for any new additions to it.
I tried switching your sample to open link. My iphone asked if I wanted to download, but then Safari didn’t know what to do with what it got, and I got a blank screen. Still getting closer! (I’m not sure my phone knows what to do with a csv?)
Yeah, that’ll output a format my iPhone understands. Here’s a tweak on the project. It’s non-functional - doesn’t take actual values, but DOES write a .vcf that my phone understands.
Where is the file saved? I just tried to open your project and it worked just fine but I don’t know where the file goes. I don’t need to be able to open the VCF file in the program I’m building. What I want to be able to do is export it to some place on their phone so that they can import the file into their address book. Ideally once the file is exported to the phone it would automatically open or show up in the address book.
If you try the project I linked above, it’ll open a fake contact card – or at least, it does on iPhone, and then there’s an ‘add contact’ button at the end. It’s proof of principle that it’ll work, not yet a working version.
I updated the project to make it workable. I found that in Android, it did not accept the file after being downloaded. I can see it and see that all information is saved but the contact app on the phone doesn’t want to import it.
I searched in the net and found that a vCard file is not a text but it is actually a binary file (8 bit bytes or extended ASCII) so I had to try different file formats and found that my phone accepted the generated file when I used file type of application/octet-stream.
I need you to test it so we can say it works on different phones.