How to save a contact photo with Ionic contacts?

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 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 is null.

var contact = Contacts.create();
    some code to fill in the other contactdetails.

if ( !== undefined && !== null) {
  if (! { = [];
  var cf = new ContactField('base64',;;

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://’);

I can not save phone number, have working code for this?


I think this should work.

createContact() {
 var contact = Contacts.create();
 contact.phoneNumbers = [];
 var cf = new ContactField('Mobile', '0476392554');
 return contact;

Thank you, for new version you should use (< any> contact).phoneNumbers for bug at ES6

Haven’t had any issue with this code so far, what changed?

I had an error as can not assign left hand side and solved with (< any> contact).phoneNumbers