0

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?

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks #Mallikarjuna, I'll try
its Confusing , But Best One I ever Seen

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.