how to convert vcard 3.0 to 2.1 using cardme
We have application which has mobile client and server application. Mobile clients gets installed in Symbian OS s60 which only supports vCard 2.1 to sending and receiving. In the server side application I am using cardme 0.2.5. which is receiving vCard version 2.1 from the mobile phone and it is getting saved properly in the database as version 2.1.
The problem comes when I edit any contact in the server application the new vCard gets saved in version 3.0 and when server syncs with the mobile device, mobile device is not able to parse vCard 3.0 properly because it supports only 2.1
While doing research I found that the the VCardWriter cannot write in vCard version 2.1 back
public void setOutputVersion(VCardVersion outputVersion) throws VCardException {
if(outputVersion == null) {
this.outputVersion = VCardVersion.V3_0;
}
else {
if(outputVersion == VCardVersion.V2_1 || outputVersion == VCardVersion.V4_0) {
throw new VCardException("Version "+outputVersion+" not supported.");
this.outputVersion = outputVersion;
}
}
Is there anyway we can write the object back to vCard version 2.1
I have tried using other jar versions but found that from cardme 2.0 onward开发者_StackOverflow社区s it only writes in vcard 3.0. Older versions doesn't support photo to be added in the vCard.
Any help or suggestion would be welcomed
Thanks
if the mobile device only has problems parsing the photo tag you could set the compatibility mode of cardme to MS_OUTLOOK. This will cause cardme to write PHOTO,LOGO,SOUND and KEY in v2.1 format.
If the above doesn't work for you, you could download version 0.1.4 of cardme which supports VCard v2.1 (including PHOTO) you can download it here cardme 0.1.4
Since the old version of cardme uses a different package name, you can re-build the vcard using the 0.1.4 version of library is another part of your program.
精彩评论