[
https://issues.apache.org/jira/browse/CB-12788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16012041#comment-16012041
]
Cyrille Colin commented on CB-12788:
[~Nikita Matrosov] , right this doesn't happen with rawId and the contact is
saved.
Shoud we use rawId instead of id ? documentation didn't mentioned rawId.
documentation source :
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-contacts/
> Crash on android when saving contact
>
>
> Key: CB-12788
> URL: https://issues.apache.org/jira/browse/CB-12788
> Project: Apache Cordova
> Issue Type: Bug
> Components: cordova-plugin-contacts
>Affects Versions: 2.3.1-dev
> Environment: Cordova : 6.1.1 via meteor
> Android : 5.0.1 on Samsung S4 GT-I9506
>Reporter: Cyrille Colin
>
> Hi,
> first i'm not sure about version, i use the one in npm and github : 2.3.1 but
> it doesn't reflect version in issue tracker.
> Step to reproduce :
> var contact = navigator.contacts.create({
> id: "12345",
> displayName: "John Doe",
> emails: [new ContactField('work', "j...@doe.com", true)]
> });
> contact.save(); crash with this stack trace :
> 05-11 15:18:58.643 24995-4607/fr.univlorraine.mobile.multi
> D/ContactsAccessor: rawId is string called 'null'
> 05-11 15:18:58.643 24995-4607/fr.univlorraine.mobile.multi
> D/ContactsAccessor: Could not get name
> 05-11 15:18:58.643 24995-4607/fr.univlorraine.mobile.multi
> D/ContactsAccessor: Could not get phone numbers
> 05-11 15:18:58.643 24995-4607/fr.univlorraine.mobile.multi
> D/ContactsAccessor: id is string called 'null'
> 05-11 15:18:58.643 24995-4607/fr.univlorraine.mobile.multi
> D/ContactsAccessor: Could not get addresses
> 05-11 15:18:58.643 24995-4607/fr.univlorraine.mobile.multi
> D/ContactsAccessor: Could not get organizations
> 05-11 15:18:58.643 24995-4607/fr.univlorraine.mobile.multi
> D/ContactsAccessor: Could not get emails
> 05-11 15:18:58.643 24995-4607/fr.univlorraine.mobile.multi
> D/ContactsAccessor: note is string called 'null'
> 05-11 15:18:58.643 24995-4607/fr.univlorraine.mobile.multi
> D/ContactsAccessor: nickname is string called 'null'
> 05-11 15:18:58.643 24995-4607/fr.univlorraine.mobile.multi
> D/ContactsAccessor: Could not get websites
> 05-11 15:18:58.643 24995-4607/fr.univlorraine.mobile.multi
> E/ContactsAccessor: Could not get birthday from JSON object
>
> org.json.JSONException: Value null at birthday of type org.json.JSONObject$1
> cannot be converted to long
>
> at org.json.JSON.typeMismatch(JSON.java:100)
>
> at org.json.JSONObject.getLong(JSONObject.java:517)
>
> at
> org.apache.cordova.contacts.ContactAccessorSdk5.getBirthday(ContactAccessorSdk5.java:1959)
>
> at
> org.apache.cordova.contacts.ContactAccessorSdk5.modifyContact(ContactAccessorSdk5.java:1471)
>
> at
> org.apache.cordova.contacts.ContactAccessorSdk5.save(ContactAccessorSdk5.java:1071)
>
> at
> org.apache.cordova.contacts.ContactManager$2.run(ContactManager.java:186)
>
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
>
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
>
> at java.lang.Thread.run(Thread.java:818)
> 05-11 15:18:58.653 24995-4607/fr.univlorraine.mobile.multi
> D/ContactsAccessor: Could not get photos
> 05-11 15:18:58.713 24995-4607/fr.univlorraine.mobile.multi E/AndroidRuntime:
> FATAL EXCEPTION: pool-1-thread-3
>
> Process: fr.univlorraine.mobile.multi, PID: 24995
>
> java.lang.NullPointerException: Attempt to invoke virtual method 'long
> java.lang.Long.longValue()' on a null object reference
>
>at android.os.Parcel.readException(Parcel.java:1546)
>