将联系人作为vcard从Android发送到iOS

时间:2018-08-01 21:30:19

标签: android vcard vcf

我正在尝试在我的应用中以编程方式创建联系人卡,并通过短信发送。它在Android到Android上都可以正常使用,但是当我尝试将其发送到iPhone时,甚至消息都没有通过。看起来好像是在Android端发送的,但是在我的iPhone上根本没有消息通过。我已经尝试过版本2.1和3.0。有什么想法吗?

 File vcfFile = new File(getContext().getExternalFilesDir(null), "generated.vcf");
 FileWriter fw = new FileWriter(vcfFile);

fw.write("BEGIN:VCARD\n" +
                "VERSION:3.0\n" +
                "NOTE:Line 1Line 2Line 3\n" +
                "END:VCARD");

fw.close();


    Intent sendIntent = new Intent(Intent.ACTION_SEND);
    sendIntent.setType("text/x-vcard");
    sendIntent.putExtra(Intent.EXTRA_STREAM,
            FileProvider.getUriForFile(getContext(), getContext().getApplicationContext().getPackageName() + ".provider", vcfFile));
    startActivity(sendIntent);

0 个答案:

没有答案