Hello guys,
I’m trying to make an app that imports contacts, who are stored on a remote server, to the phone.
These contacts have base64 thumbnail pictures on the server, but I can’t seem to save the pictures.
I’m using the following code to check if the user has a photo or not and if contact.photos is initialized. after that I push a contactfield with the base64-type and the photo in base64.
the console.log(contact) outputs the contact with the picture, but after using the save method from Ionic native contact the logs say that contact.photos is null.
var contact = Contacts.create();
/*
some code to fill in the other contactdetails.
*/
if (user.photo !== undefined && user.photo !== null) {
if (!contact.photos) {
contact.photos = [];
}
var cf = new ContactField('base64', user.photo);
contact.photos.push(cf);
console.log(contact);
contact.save();
Any Ideas on how to fix this?
Also tried using the url of an excisting contact photo but that has the same problem…
var cf = new ContactField(‘url’, ’ content://com.android.contacts/contacts/9291/photo’);