Search code examples
cordovaphonegap-pluginscontactsandroid-contactscordova-plugins

How do you specify URLs for Contact.photos?


https://github.com/apache/cordova-plugin-contacts#contact

Where can I put the image file (eg can I have it on S3, or shipped with the app in the resources), and what is the correct format for the URL?

var contact = navigator.contacts.create();
contact.photos = [new ContactField('url', URL, true)];
contact.save()

Solution

  • This is your answer....Sir.

    var photos = [];
    
    var ImgUrl="images/Thomas.jpg";
    
    photos[0] = new ContactField('url', ImgUrl,true);
    contact.photos = photos;