Sync contacts using cordova plugin contacts


#1

Hi everyone :slight_smile: ,

I created ionic-v1 app that sync cloud contacts to the android/ios contacts, i get success but didn’t get expected behaviour please see below issue for android and ios.

Ios:
1. Contacts get created but app freezed until contact get created.
2. Freezed when cordova native function execute through ionic

    var nativeContact = navigator.contacts.create(contact);
    $cordovaContacts.save(nativeContact).then(function(result) {
        console.log('save contact success');
    }, function(err) {
        console.log('save contact err',err);
    });

Also i need to update contact if contact exist for that i used to pass exist contact id in save contact.

Android :
1. In android code works perfect but contact got saved 43 out of 51 if i repeat sync process then it’s reach to 51 successfully.
2. For unsuccessfull save there is error ContactError.UNKNOWN_ERROR (code 0)

If any one help me to get ride of contact sync in ionic-v1 using plugin cordova contacts so it would be great. :smile:

Ionic-info

cli packages:

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 7.1.0 
Gulp CLI              : CLI version 3.9.1 Local version 3.9.1

local packages:

Cordova Platforms : android 6.4.0 ios 4.5.4
Ionic Framework   : ionic1 1.3.2

System:

Android SDK Tools : 25.2.5
ios-deploy        : 1.9.2 
Node              : v6.11.0
npm               : 5.4.2 
OS                : macOS Sierra
Xcode             : Xcode 9.0.1 Build version 9A1004 

Environment Variables:

ANDROID_HOME : ****/android-sdk-macosx

Misc:

backend : legacy

Edit :
Plugin version for cordova-plugin-contacts is 2.2.1