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

Using AlarmManager to sync data with a server

First of all, I apologize for my English. I need to sent data to a server and query for data in that server from time to time, maybe from week to week. So I'm going to use the AlarmManager to do that. I wanna know if I can register two separated…
0
votes
1 answer

How should the app react if an authToken invalidates

in my project I need to connect regularly to a server. Therefore I'm implementing an AccountAuthenticator and SyncAdapter to plug them into androids framework. It is critical for the application to connect regularly, say every 5 or 10 minutes. No…
Adam
  • 21
  • 5
0
votes
1 answer

Android ordered syncs

I am investigating on how to call sync adapters in a precise order. Indeed, I have several providers for items such as clients and contracts. Syncing one of those means: Sending local modifications to the server for updating its database (such as…
0
votes
1 answer

How to create a calendar event in android emulator.

I am trying to add calendar events to my custom account.. I have successfully created a calendar event using following code, private static long addCalendar(Account account) throws RemoteException, OperationApplicationException { Uri…
0
votes
1 answer

How to synchronize data between an account and a web server in android?

How to synchronize data between an account and a web server in android? I have created a project where I am trying to create an account of my own and through that account I want to get the server data after a specific amount of interval period. So…
0
votes
1 answer

SyncAdapter - detect when to synchronize server with the client (mobile)

I have a form inside my mobileApp to add a new item. When there are no internet connection, and that an item is added to sqlite localdb, I want this data to be uploaded to the server (synced), once device is connected to the internet. I have…
0
votes
1 answer

Re initate Sync adapter in android

I'm able to successfully create Sync adapter in my phone, but i'm not able to handle a particular scenario. My task sync app, requires the tasks permission to fetch tasks or it applicable for getting permission for any service from Google server.…
0
votes
3 answers

How to pause and resume thread in android

When I get UserRecoverableAuthIOException in AbstractThreadedSyncAdapter, I'm creating a notification as below. Here's how I'm creating the service: @Override public IBinder onBind(Intent arg0) { // TODO Auto-generated method stub …
Naruto
  • 9,476
  • 37
  • 118
  • 201
0
votes
1 answer

How to access Appication objects from Sync Adapter

I am working on an IM application with open fire server. I'm implementing Sync Adapter for managing the contacts. From my sync adapter's onPerformSync() if I access the connection object which I kept in my Application class it returns null. What am…
Ram
  • 845
  • 1
  • 13
  • 26
0
votes
1 answer

java.lang.VerifyError using SyncAdapter

I'm developing an app using this tutorial: http://udinic.wordpress.com/2013/07/24/write-your-own-android-sync-adapter/ and code from this repository: https://github.com/Udinic/SyncAdapter. But when I'm trying to trigger the sync process, I get…
kmaci
  • 3,094
  • 2
  • 18
  • 28
0
votes
1 answer

Android SyncAdapter with 2 kind of accounts

I'd like to use a SyncAdapter for my application. The SyncAdapter needs an Account. In my app, there can be authenticated users and also anonymous ones. How to deal with that? Create a fake account (anonymous) with the same Authenticator? And manage…
Jerome VDL
  • 3,376
  • 4
  • 32
  • 33
0
votes
3 answers

Android developers syncadapter tutorial out of date?

Is the android developers syncadapter tutorial out of date. Because i was trying to implement a sync adapter in my application that syncs data to a server. But when implementing the following part i get eclipse errors. Implementing the syncadapter…
0
votes
1 answer

How to pass an object from activity to sync adapter?

I have GoogleAccountCredential object from google api that i create in my activity and i need it in my sync adapter.How can i send it to there?I suppose synchronization take place in another process ,so it is possible to have object from activity in…
Lester
  • 2,544
  • 4
  • 27
  • 38
0
votes
1 answer

Change values of Bundle parameters of addPeriodicSync()

I am using a SyncAdapter in my application in which the frequency of Periodic Sync is increased when user enters a particular activity. I wanted to know if there is a way in which I can let the application know which activity has called the…
0
votes
1 answer

Change Timer for Periodic Sync

I have used syncadapter to periodically send data to the server. I am calling it when the application starts using the following piece of code ContentResolver.addPeriodicSync( mAccount, AUTHORITY, bundleParams, …