cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Filip Maj (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-10496) Missing documentation Contacts-Plugin
Date Thu, 23 Feb 2017 05:39:45 GMT

    [ https://issues.apache.org/jira/browse/CB-10496?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15879908#comment-15879908
] 

Filip Maj commented on CB-10496:
--------------------------------

I can confirm that on iOS 10.2 on an iPhone 5S, the following code correctly shows the contact
image in the native contacts viewer when a contact is created using the Contacts API:

{noformat}
var contact = navigator.contacts.create({"displayName": "Test User"});
var name = new ContactName();
name.givenName = "Jane";
name.familyName = "Doe";
contact.name = name;
var photos = [];
photos[0] = new ContactField('base64', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==',
false);
contact.photos = photos;
contact.save(function() {
    alert('we saved the freaking contact');
}, function(err) {
    alert('there was an error saving contact!');
    alert(err);
});
{noformat}

On Android, this same code does _not_ add a photo and can confirm this stack trace from logcat:

{noformat}
E/ContactsAccessor( 2821): java.io.FileNotFoundException: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4/8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==:
open failed: ENOENT (No such file or directory)
E/ContactsAccessor( 2821): 	at libcore.io.IoBridge.open(IoBridge.java:456)
E/ContactsAccessor( 2821): 	at java.io.FileInputStream.<init>(FileInputStream.java:76)
E/ContactsAccessor( 2821): 	at java.io.FileInputStream.<init>(FileInputStream.java:103)
E/ContactsAccessor( 2821): 	at org.apache.cordova.contacts.ContactAccessorSdk5.getPathFromUri(ContactAccessorSdk5.java:1705)
E/ContactsAccessor( 2821): 	at org.apache.cordova.contacts.ContactAccessorSdk5.getPhotoBytes(ContactAccessorSdk5.java:1665)
E/ContactsAccessor( 2821): 	at org.apache.cordova.contacts.ContactAccessorSdk5.insertPhoto(ContactAccessorSdk5.java:1643)
E/ContactsAccessor( 2821): 	at org.apache.cordova.contacts.ContactAccessorSdk5.createNewContact(ContactAccessorSdk5.java:1866)
E/ContactsAccessor( 2821): 	at org.apache.cordova.contacts.ContactAccessorSdk5.save(ContactAccessorSdk5.java:1044)
E/ContactsAccessor( 2821): 	at org.apache.cordova.contacts.ContactManager$2.run(ContactManager.java:186)
E/ContactsAccessor( 2821): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/ContactsAccessor( 2821): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/ContactsAccessor( 2821): 	at java.lang.Thread.run(Thread.java:818)
{noformat}

> Missing documentation Contacts-Plugin
> -------------------------------------
>
>                 Key: CB-10496
>                 URL: https://issues.apache.org/jira/browse/CB-10496
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Contacts
>            Reporter: Arne
>            Priority: Minor
>              Labels: docs, triaged
>
> Missing documentation on how to set a new contact photo when creating an contact via
plugin.
> I am trying to create a contact (works fine) but have no idea how to  provide a new picture
(uploaded) to it.
> Tried to set "photos[0].value" to an base64 encoded picture .. but it is not displayed
in contact.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message