T.Q.H
T.Q.H

Reputation: 89

Android synchronize SQLite db with SQLServer db

I have a task of sync SQLite DB with SQLServer DB. (Real-time is not necessary, may be delay 2 - 4 mins)

I DO:

  1. Created background services and repeat with AlarmManager
  2. The services call web services end point to get all details from remote server (RestFul APIs)
  3. Save the parsed details in SQLite database.

But, there are a lot of data to GET/POST, so the device consumes a lot of resource to process, and I fell it's slow.

How to solve this?

Upvotes: 0

Views: 101

Answers (1)

Mallikarjuna
Mallikarjuna

Reputation: 884

Creating a Sync Adapter

The sync adapter component in your app encapsulates the code for the tasks that transfer data between the device and a server. Based on the scheduling and triggers you provide in your app, the sync adapter framework runs the code in the sync adapter component. To add a sync adapter component to your app, you need to add the following pieces:

Sync adapter class.

A class that wraps your data transfer code in an interface compatible with the sync adapter framework.

Bound Service.

A component that allows the sync adapter framework to run the code in your sync adapter class.

Sync adapter XML metadata file.

A file containing information about your sync adapter. The framework reads this file to find out how to load and schedule your data transfer.

Declarations in the app manifest.

XML that declares the bound service and points to sync adapter-specific metadata.

This lesson shows you how to define these elements

Create a Sync Adapter Class

https://developer.android.com/training/sync-adapters/creating-sync-adapter.html#CreateSyncAdapter

Upvotes: 1

Related Questions