How can I send vcard/contacts/?vcf var SMS or MMS in Android?

lybeen picture lybeen · May 21, 2011 · Viewed 7.1k times · Source

I want to modify the Android source code that can send (contacts/vcard/.vcf file) by MMS or SMS, the Android default way is through Bluetooth. I find a lot of ways, but it all doesn't work. I know the vcf format is like this:

BEGIN:VCARD
VERSION:2.1
N:;lybeen;;;
FN:lybeen
TEL;CELL;
PREF:1-123-234-1234
TEL;CELL:000-111-1111
END:VCARD

I send this string by SMS as a plain message. Some Android phone can recognize this as a contact, however, most of the Android phone can not recognize, but I don't know how to send the contacts by MMS.

Answer

Sahil Mahajan Mj picture Sahil Mahajan Mj · Nov 21, 2012

though i think i am late in answering the question, whether it will help the OP or not, but it will always be helpfull for the future visitors.

To send Vcard through mms, you just need to attach the .vcf file with the system's intent.

            Intent sendIntent = new Intent(Intent.ACTION_SEND);
            sendIntent.setType("text/x-vcard");
            sendIntent.putExtra(Intent.EXTRA_STREAM,
                    Uri.fromFile(outputFile));
            startActivity(sendIntent);