Example usage for android.content ContentResolver getCurrentSyncs

List of usage examples for android.content ContentResolver getCurrentSyncs

Introduction

In this page you can find the example usage for android.content ContentResolver getCurrentSyncs.

Prototype

public static List<SyncInfo> getCurrentSyncs() 

Source Link

Document

Returns a list with information about all the active syncs.

Usage

From source file:com.clearcenter.mobile_demo.mdStatusActivity.java

protected void onResume() {
    super.onResume();

    observer = new mdDeviceSamplesObserver(observer_handler, this);
    ContentResolver resolver = getContentResolver();
    resolver.registerContentObserver(mdDeviceSamples.CONTENT_URI, true, observer);

    updateData();/*from  w w w .j a  va 2 s  .c om*/

    final Account account = new Account(account_nickname, mdConstants.ACCOUNT_TYPE);
    resolver.requestSync(account, mdContentProvider.AUTHORITY, new Bundle());

    if (android.os.Build.VERSION.SDK_INT >= 11) {
        List<SyncInfo> syncs = resolver.getCurrentSyncs();
        for (SyncInfo info : syncs) {
            Log.d(TAG, "account: " + info.account.name + ", authority: " + info.authority + ", startTime: "
                    + info.startTime);
        }
    }
}