How to send vcard as an sms/mms?

2019-06-27 23:05发布

问题:

Hi everyone, I am working on an application,which has the functionality of sending vcard(vcf files),Ive generated a vcf file of a particular contact and able to send it using email, but i want to send it via sms / mms functionality and unable to do so.Ive gone through the forum , in many question they suggested sendDataMessage but it is not wokring for me.In some solutions they suggested Intent.EXRTA_STREAM , but it is also not working , so please give me an alternative way to send a vcard from my application or try to provide some code.Thanx

回答1:

As you have generated .vcf file of vcard. then you can attach this file with the system's intent to send it as MMS.

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