Questions tagged [android-syncadapter]

An Android service that synchronizes data between an Android device and a server

A SyncAdapter is an Android Service that synchronizes data between an Android device and a backend server. SyncAdapters can be part of an Android program, or can be a standalone entity. SyncAdapters are associated with an Account, which defines a collection of data that belongs to a specific application.

The purpose of a SyncAdapter is to ensure that data is kept consistent on the Android device and a server. When the data is changed on the server, the SyncAdapter must identify that a change has been made, and update the data on the Android device to reflect the change.

The most common type of data that is synchronized using SyncAdapters are your Contacts list. Whenever you add a contact on your phone, the contact is also sent to the Google server and stored within. Similarly, if you add a contact from a different Google service, such as GMail, the SyncAdapter will identify that a contact has been added, and replicate the data onto your Android device.

Any type of data can be synced with a backend server, its only dependent on the type of data that your application is dealing with. Other common data types to be synced in this way are Calendars and To-Do/Task lists.

The reason why SyncAdapters exist is to create a local copy of the data, so that it can be accessed quickly without the need for a data connection. For example, if your contacts are kept synced, then you can access your contacts quickly on your Android device regardless of whether you have data access or not - it's all locally-stored data independent from network requirements.

SyncAdapters will usually send a 'check' message to the server on a periodic basis, say every 30 minutes, to ask whether any changes have been made during this time. This is only a small data exchange, and doesn't consume much network data. Further 'synchronization' steps only occur if the data has changed and needs to be updated on the Android device accordingly.

SyncAdapter Class Reference

606 questions
0
votes
0 answers

Why is ContentResolver.setIsSyncable not working for me?

I am writing an app which uses the SyncAdapter framework. By default, the user has to activate the sync in the android account settings. However, I was told that by calling ContentResolver.setIsSyncable (mAccount, AUTHORITY,1); I can activate…
0
votes
1 answer

How to automatically delete supplementary RawContact?

I would like to insert RawContact records to provide supplementary data for contacts. I use the AggregateExceptions table to link the real RawContact with mine. I'd like to know how can I automatically delete my RawContact when the original is…
0
votes
0 answers

AsyncTask vs SyncAdapter

I am planning to build an application which gets some data from a public API and then binds the data to controls on my Activity. For this task, I could utilize AsyncTask which will allow the API call to run on a separate thread than the UI and then…
0
votes
1 answer

Backend and Android technology for fast periodic communication

I'm trying to implement a fast communication between two android phones at a certain moment by, preferably, going through a server (since it's easier to be consistent). The phones have to communicate their gps locations every x seconds, with x being…
Mehdi
  • 713
  • 9
  • 19
0
votes
2 answers

SyncAdapters.requestSync and Android SyncManager

I'm trying to understand the workings of SyncAdapters. I looked at the code for when we receive a GCM notification from a broadcast receiver. We want to force the SyncAdapter to sync immediately by calling requestSync as the GCM is telling my app…
Simon
  • 19,658
  • 27
  • 149
  • 217
0
votes
1 answer

Exceptions during the "SyncAdapter" execution

I have got problem implementing a Syncadapter which has a dummy account and a dummmy accountauthenticator. My accountauthenticator,CNAuthenticator: public class CNAuthenticator extends AbstractAccountAuthenticator { public CNAuthenticator(Context…
Tejas
  • 520
  • 4
  • 15
0
votes
1 answer

Google IO 2010 Virgil Dobjanschi pattern C example

I have tried Virgil Dobjanschi patterns A and B and made a conclusion that i want to use pattern C because in that case I can use google based code which take care about how to get may data to a device if i have non-stable network connection and so…
0
votes
0 answers

How to show app icon in front of a contact associated with the App like whats app

I want to show my app icon in contact Book with each contact that is associated with my app I have followed this https://github.com/c99koder/AndroidSyncProviderDemo and write my own sync adapter but whenever I added any contact that is associated…
Sandeep dhiman
  • 1,863
  • 2
  • 17
  • 22
0
votes
1 answer

android sync native contact into local db

I'm developing chatting app in which I want to sync android native contact on first time login into my local database. The problem is that in my onPerformSync method, i'm syncing native contact into local db but in the mean while, if user tries to…
0
votes
1 answer

How to call SyncAdapter in android on a particular time

I want to call my sync adapter whenever I insert any contact value in my Sq-lite Database in my application It will work fine whenever I do it manually in Account & sync section of Settings but I want to do it automatically whenever any contact is…
Sandeep dhiman
  • 1,863
  • 2
  • 17
  • 22
0
votes
1 answer

SyncAdapter stops working with full memory

We use the SyncAdapter to send data to the server. It works perfectly almost always. But we identified one problem. When the phone physical memory is full, the SyncAdapter seems to stop working. It seems to delay the execution until some memory is…
Bruno da Hora
  • 61
  • 1
  • 3
0
votes
0 answers

Trigger notification from SyncAdapter onPerformSync

I'm running a sync adapter that periodically check if there are new data available at the remote server. If there is a new data I want to create a notification about it. It seems that the whole mechanism works fine but not EVERY time. Sometimes I…
0
votes
2 answers

ListView not updating after web service Sync

I have impelmented SyncAdapter that calls webservice and insert/update database. I would like to show some of this data in ListView so i implemented ListFragment in witch the data is displayed via CursorAdapter. And everything works ok, except when…
0
votes
1 answer

Use syncAdapter for real time data ( small scale of data)

in order to transfer data i want to use syncAdapter. i read this article : http://developer.android.com/training/sync-adapters/index.html. it's been written that " Sync adapters run asynchronously, so you should use them with the expectation that…
Adamed
  • 1
  • 1
0
votes
1 answer

Communicate from background thread to main via Greenrobot Eventbus

In my app I use SyncAdapter(AbstractThreadedSyncAdapter) for synchronisation with server. Basically in background service I insert data to sql table, then on finish I want to inform UI to update ListView with new data. For this matter I tried to use…
Rafael
  • 6,091
  • 5
  • 54
  • 79