Search code examples
angulartypescriptnativescriptgoogle-contacts-api

nativescript-contacts How to sync with google contacts?


Using Nativescript 5.0 with Angular

Using nativescript-contacts plugin to read, modify and create contact. Its working perfectly.

Contacts created by my Android App using nativescript-contacts are not getting sync with Google Contacts.

Andorid phone shows the newly created contact (name & number), so there is no problem in contact creation process, but I expect this newly created contact should get sync in with google contacts. I am checking google contacts on web using the same gmail account as it is used in Android phone.

I just want newly created contact to be backed up, so in future this phone breaks down, I will get all those contacts created by my App from google contacts.

I am using exactly same code as shown in this page of the plugin. https://www.npmjs.com/package/nativescript-contacts

Any pointers for me, to get it done? Thanks in advance.


Solution

  • The contacts plug-in saves the contact on the first available account on device, fortunately if that becomes your Google account then sync will be taken care by default.

    In case if that is not a Google account then you will have to override the save method to choose right account.