You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Arne (JIRA)" <ji...@apache.org> on 2016/02/05 06:33:39 UTC
[jira] [Commented] (CB-10496) Missing documentation Contacts-Plugin
[ https://issues.apache.org/jira/browse/CB-10496?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15133698#comment-15133698 ]
Arne commented on CB-10496:
---------------------------
Found an "bug" in Cordova Contacts Plugin:
platforms/android/src/org/apache/cordova/contacts/ContactAccessorSdk5.java
private InputStream getPathFromUri(String path) throws IOException
Missing function to handle the base64 stuff! If i add:
if (path.startsWith("data:")) {
String dataInfos = path.substring(0, path.indexOf(','));
dataInfos = dataInfos.substring(dataInfos.indexOf(':') + 1);
String baseEncoding = dataInfos.substring(dataInfos.indexOf(';') + 1);
if("base64".equalsIgnoreCase(baseEncoding)) {
String img = path.substring(path.indexOf(',') + 1);
byte[] encodedData = img.getBytes();
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(encodedData, 0, encodedData.length);
Base64InputStream base64InputStream = new Base64InputStream(byteArrayInputStream, Base64.DEFAULT);
return base64InputStream;
} else {
Log.w(LOG_TAG, "Could not decode image. Encoding is " + baseEncoding);
}
}
it works fine
> 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.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org