Automatically add / sync contacts

I am developing an Android Android application and want to automatically add / synchronize contacts, for example whatsapp, when the user installs the application and whenever a new contact is added or deleted. I intend to use the xmpp or java library for the application. Thanks

+3
source share
1 answer

If your contact synchronization is separate from your chat application, you should use SyncAdapter. It works like Android service, so it can sync contacts with the server even if your chat application doesn’t work. See the following URL SampleSyncAdapterprovided by Google, which provides the source code and information for creating your own SyncAdapter... http://developer.android.com/resources/samples/SampleSyncAdapter/index.html

If you want to synchronize contacts only when the application is running, you actually do not need any kind of synchronization mechanism, you just need to add contacts to your device.

, ContactsContract, Android. ContactsContract , - , ContactsContract.CommonDataKinds.Email . . URL ContactsContract... http://developer.android.com/reference/android/provider/ContactsContract.html

SampleSyncAdapter http://developer.android.com/resources/samples/SampleSyncAdapter/index.html, , Android, , ContactsContract SyncAdapter, .

+6

All Articles