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

Continious transaction with ContentProvider

I have a huge XML file (more than 20 Mb) and I can't change its format. It represents DB. In fixed periods of time it can change and I must update all changed data on a device. I am using SyncAdapter to transfer a huge amount of data from XML to…
0
votes
1 answer

Accessing Resources inside SyncAdapter

I have developed a syncadapter class as specified on the developer site. I am frequently sending data to the server using onPerformSync() every 1 hour. The problem I am facing is I am not able to use getResources().getString(R.string.domain_name)…
Roadblock
  • 2,041
  • 2
  • 24
  • 38
0
votes
1 answer

Sync adapter not trigger my activity

I have used Sync Adapter to my app to automatically update the db content,but its not working, even i dint get any log messages This is my sync adapter class public class SynAdapter extends AbstractThreadedSyncAdapter { private…
Madhu
  • 1,780
  • 23
  • 47
0
votes
0 answers

SyncAdapter : Periodic Sync only when app in foreground

I have a SyncAdapter that periodically pull a request to the Server. I init the sync with addPeriodicSync() in my main Activity and all works fine. But i'd like to prevent the synchadapter to trigger onPerformSynch while the app is in background. I…
Nameless
  • 259
  • 2
  • 4
  • 15
0
votes
1 answer

SyncAdapter for single POJO

I have user data which is accessed via a REST API which I wish to have periodically synced to allow giving the user notifications and such. I've already implemented an AccountAuthenticator and related classes, but I'm having troubles with creating…
user348040
0
votes
0 answers

How to save data from android application to a server?

I'm developing an app in android using the developers training that can be found at: http://developer.android.com/training/index.html I created a registration activity and wanted to know how to save the detail on a server! The training is based on…
user2599068
  • 21
  • 2
  • 6
0
votes
2 answers

Android - SyncAdapter Callback

Some preliminary information: I have to create an API for an Android Library. This API has to deal with basic CRUD (find, find all, insert, update, delete) operations of generic data. Then other apps that use this library can use this API with any…
0
votes
0 answers

Disable ContentProvider notification while SyncAdapter is running

I use a ContentProvider to handle my data, and an AbstractThreadedSyncAdapter to sync it. In my SyncAdapter.onPerformSyncmethod, I use the ContentProviderClient parameter to add some data. However, when I update my data, my provider notifies the…
Marc Plano-Lesay
  • 6,808
  • 10
  • 44
  • 75
0
votes
2 answers

How to trigger syncadapter event every day?

I'm using a syncadapter in my application. I need it to trigger an event every day, at 6 AM. Is that possible? Is there a way to trigger a syncadapter event every day at a given time? Thanks!
Michael Eilers Smith
  • 8,466
  • 20
  • 71
  • 106
0
votes
1 answer

ANDROID : BasicSyncAdapter with parser JSON ANDROID

i am block on a problem and i need your expertise. I downloaded the BasicSyncAdapter of Android , on here and i succeeded to use it on my android projet, BUT it's work with FeedParser in XML... And i would like to work with JSON data, so with parser…
Thomas Trabelsi
  • 330
  • 1
  • 8
  • 21
0
votes
1 answer

How to call a method in full life time of the application

i am developing sample application, it has a sqlite and mysql databases. if internet connection has data goes to the web server database(mysql database), if haven' t a internet connection data save sqlite database, after reopening application…
0
votes
1 answer

How to handle SyncAdapter requests to a RESTful web service

I am trying to build a contacts web service which could be synced with various RESTful clients. Android has a Contacts provider and a SyncAdapter to do the job but i am actually trying to figure out how my web service should be like? I mean is…
mmahgoub
  • 3,910
  • 3
  • 20
  • 19
0
votes
1 answer

Update masters SQLite database table in local with MS SQL in Server

I want to update the local SQLite database table(masters) in my device with MS SQL database table in the Server. Here am using SOAP Service. If any new values are inserted in the server then on click of a button it must sync and update the new…
0
votes
0 answers

Stub Authenticator & Stub Content Provider for Google Calendar SyncAdapter - Android

Do I need to implement Stub Authenticator & Stub Content Provider, if I want to handle sync data of com.android.calendar authority & com.google account types in onPerfomSync method ? Or will the sync adapter framework recognize that I'm going to use…
damax
  • 453
  • 1
  • 5
  • 18
0
votes
1 answer

infinite sync loop syncadapter

I have the same problem stated here: Android SyncAdapter stuck in infinite sync loop But after trying to implement the notifychange (Uri uri, ContentObserver observer, boolean syncToNetwork) in onPerformSync, I realized that I didn't know how to get…
user1549672
  • 486
  • 1
  • 6
  • 16