4

Currently I'm working on an app in which, I use sqlite database when there is no internet connection on device and use web services when internet is available.

I have to ask that what, is the best method for synchronization?

  • Is it possible by setting flags and check for updates and then synchronize.
  • or any tool is available which takes care of that.
  • or any other method available.
2
  • your problem is about to check synced date in android app? Commented Dec 24, 2012 at 6:27
  • I want to sync SQLite database with MySQL whenever internet connection is found. Commented Apr 22, 2013 at 5:22

3 Answers 3

2

I think make a boolean function just like:-

public static boolean isNetworkAvailable(Context context) {
    ConnectivityManager connectivityManager = (ConnectivityManager) context
            .getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo info = connectivityManager.getActiveNetworkInfo();
    if (info == null)
        return false;

    return info.isConnected();
}

& Check if Network is available :-- Call Web Services otherwise Call Your SQLite Database.

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

Comments

2

You can do one thing:

Whenever you make a web call, return one field value "LastSyncedDate", store this date value in Android app.

So whenever you make a web call next time, send this stored value inside web call.

Note: This answer is for checking last synced made in android app.

1 Comment

thanks for your answer....but is there any ready tool available which take care of synchronization.
1

SymmetricDS Pro is a tool designed to synchronize SQLite databases on Android.

SymmetricDS now has its web-enabled, fault-tolerant, database synchronization software available on the Android mobile computing platform. The Android client follows all of the same concepts and brings to Android all of the same core SymmetricDS features as the full-featured, Java-based SymmetricDS client. The client is designed to be referenced as a library to run in-process with an Android application requiring synchronization for its SQLite database.

Synchronizing Android Applications

Comments

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.