We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What am i missing? I am able to add contact as a file. But not in sender intent
` VCard vcard = new VCard(); String fileName = "null"; String num = getRawNUmber(item); if (num != null) { vcard.addTelephoneNumber(num, TelephoneType.CELL); } fileName = item.getDisplayNamePrimary(); vcard.setFormattedName(item.getDisplayNamePrimary());
vcard.setKind(Kind.individual()); vcard.setGender(Gender.male()); vcard.addLanguage("en-US"); StructuredName n = new StructuredName(); n.setFamily("Doe"); n.setGiven("Jonathan"); n.getPrefixes().add("Mr"); vcard.setStructuredName(n); vcard.setRevision(Revision.now()); vcard.validate(VCardVersion.V4_0); File files = new File(context.getFilesDir(), fileName + ".vcf"); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { try { files.createNewFile(); Path file = Paths.get(files.getAbsolutePath()); Ezvcard.write(vcard).version(VCardVersion.V4_0).go(file); Uri fileUri = FileProvider.getUriForFile(context, context.getPackageName() + ".provider", files); Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/vcard"); shareIntent.putExtra(Intent.EXTRA_STREAM, fileUri); shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Share Contact"); shareIntent.putExtra(Intent.EXTRA_TEXT, "Here's a contact."); context.startActivity(Intent.createChooser(shareIntent, "Share contact using...")); } catch (IOException e) { throw new RuntimeException(e); } }`
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What am i missing? I am able to add contact as a file. But not in sender intent
` VCard vcard = new VCard();
String fileName = "null";
String num = getRawNUmber(item);
if (num != null) {
vcard.addTelephoneNumber(num, TelephoneType.CELL);
}
fileName = item.getDisplayNamePrimary();
vcard.setFormattedName(item.getDisplayNamePrimary());
The text was updated successfully, but these errors were encountered: