Closed degiorgig closed 8 years ago
Hi Giovanni,
You can call the addParameter()
method on the Telephone
object. But you shouldn't put spaces in parameter names. The consuming application may not be able to read it.
Telephone tel = new Telephone("+1123123123");
tel.addParameter("X-Customer Service", "");
Hi Mike, Thank you for the reply, I did exactly like that but it returns:
TEL;X-Customer Service= :+1123123123
And that is not working on android, namely the number will be imported but the custom label not. Is there a way to have it without '='?
Well, all parameters are "supposed" to have a name and a value. But you can get around this by assigning a "TYPE" parameter to the property, as demonstrated below. The vCard must be written under version 2.1 for this to work.
VCard vcard = new VCard();
vcard.setVersion(VCardVersion.V2_1);
Telephone tel = new Telephone("+1123123123");
tel.getParameters().addType("X-Customer Service");
vcard.addTelephoneNumber(tel);
vcard.write(System.out);
Outputs:
BEGIN:VCARD
VERSION:2.1
TEL;X-CUSTOMER SERVICE:+1123123123
X-PRODID:ez-vcard 0.9.8
END:VCARD
Lovely it is working, thanks!
Hi,
I would like to add an extended property to the telephone number but is not working.
The result should be something like that: TEL;X-Customer Service:+1123123123
Thanks