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
1 answer

IBM mobile first: sendActionToJS not working with background service in Android

In my Application, I am trying to make a sync adapter service in Android which will run in the background when the app is killed. This service will call WL.getInstance().sendActionToJS() to send the control to js. I am…
0
votes
2 answers

Using IBM mobile first Android sdk in Background service when the app is killed.

We are trying to make a sync adapter service in Android which will run in the background when the app is killed. This service will fetch some data from JsonStore and will sync up with the server. Code: try { URI adapterPath = new…
0
votes
0 answers

How to use SyncAdapter for multiple request?

I have more than one request to get data from server. Is it posibble if I use one syncAdapter to handle it ? or need one syncAdapter for each request ? if possible use one syncAdapter, please give some code snippet.
0
votes
0 answers

ContentResolver requestSync doesnt work with time interval

public static void syncImmediately(Context context) { Bundle bundle = new Bundle(); bundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); …
Nikhil Soni
  • 1,011
  • 1
  • 11
  • 23
0
votes
0 answers

Sync adapter not auto syncing

The update interval time given by me is 30s but the adapter doesn't sync in 30s and second strange behavior is that it syncs twice at start, i have registered all the xml and also registered the service in manifest still it wont sync in…
Nikhil Soni
  • 119
  • 9
0
votes
0 answers

android different apks same authenticator account type

I want to understand what happens if two or more different apks tries to register with an account authenticator of same account-type. some articles like this http://blog.udinic.com/2013/04/24/write-your-own-android-authenticator (and SO questions…
0
votes
1 answer

Progrommatically created Calendar not saved

I'm trying to create calendar by using code from this topic private static void createCalendar( Context mContext, Account account) { final ContentValues v = new ContentValues(); v.put(CalendarContract.Calendars.NAME,"TEST"); …
0
votes
1 answer

How to receive GPS Location and inflate Fragment MapView to programmatically add markers with SyncAdapter

Well, after reading many examples and many posts in this site I have solved some problems and finally I managed to have the fragment responding and my syncAdapter working. But after all these days trying many things I can't yet see the map. All I…
0
votes
1 answer

GoogleApiClient.blockingConnect() does not work with GOOGLE_SIGN_IN_API

I have a SyncAdapter (code does not run on the UI thread) that writes to the app folder on Google Drive. This was working fine with the GoogleApiClient without Google Sign-In, but I am trying to move to GoogleApiClient with Google Sign-In. The…
0
votes
1 answer

Android,What is the best way to kill AbstractThreadedSyncAdapter?

I'm using SyncAdapter in my application. My problem is if I log out and then call ContentResolver.requestSync(myAccount, MyProvider.AUTHORITY, settingsBundle); it still calls the parse cloud based on previous parse user data. But before log out I…
e.k
  • 1,333
  • 1
  • 17
  • 36
0
votes
1 answer

Realm incorrect thread error from SyncAdapter

So I have created a very standard sync adapter (using this fantastic tutorial) and during onPerformSync I run some realm transactions in a method called syncDatastore within my DataManager class. The issue is when the sync adapter tries to perform…
barnacle.m
  • 2,070
  • 3
  • 38
  • 82
0
votes
1 answer

How to avoid infinite (back-to-back) syncing for contacts that are saved on sim card ? What would be the best practice?

I am working on an app that syncs device contacts with a server and I stumbled across this situation. Sim card contacts are not being aggregated with the rest of them so every time a sync is performed, the syncAdapter finds them as a new contact and…
DoruChidean
  • 7,941
  • 1
  • 29
  • 33
0
votes
0 answers

Simple Cursor Adapter, Content Provider with Inner Join displays data only one time

I have the problem, that my ListView shows the data only one time. If am closing the application and open it again, it doesn't show anything. I have a Content Provider for retrieving the data from a SQLite database. I have a SyncAdapter which is…
Simon Pio.
  • 115
  • 1
  • 14
0
votes
2 answers

Bind SyncAdapter service to Activity

I'm currently working with a SyncAdapter that syncs data every 15 minutes. Is it possible to bind that Service to the Activity so I can show the user what the currenty sync status is? I read in the documentation about IPC between services and…
0
votes
1 answer

Account settings crash on Marshmallow

I have an app working on JB (API 18) with my own account authenticator and sync adapter. When i run the app on Marshmallow, the app itself is running good, but when i trying to enter my account and sync settings - it crashes. I mean when i go to…