Android Open Source - AndroidSyncAndAccounts Sync Adapter






From Project

Back to project page AndroidSyncAndAccounts.

License

The source code is released under:

Apache License

If you think the Android project AndroidSyncAndAccounts listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.jakubczyk.syncandaccoutns.provider;
//  w w  w.  j ava2  s  .c  o m
import android.accounts.Account;
import android.content.AbstractThreadedSyncAdapter;
import android.content.ContentProviderClient;
import android.content.Context;
import android.content.SyncResult;
import android.os.Bundle;
import android.util.Log;

import java.text.SimpleDateFormat;
import java.util.Date;

public class SyncAdapter extends AbstractThreadedSyncAdapter {


    public SyncAdapter(Context context, boolean autoInitialize) {
        super(context, autoInitialize);
        Log.d("DDD", String.format("Context: %s\t autoInitialize: %s", context, autoInitialize));
    }

    public SyncAdapter(Context context, boolean autoInitialize, boolean allowParallelSyncs) {
        super(context, autoInitialize, allowParallelSyncs);
        Log.d("DDD", String.format("Context: %s\t autoInitialize: %s\tallowParallelSyncs: %s", context, autoInitialize, allowParallelSyncs));
    }

    @Override
    public void onPerformSync(Account account, Bundle bundle, String authority, ContentProviderClient contentProviderClient, SyncResult syncResult) {
        String format = "Account: %s\nBundle: %s\nAuthority: %s\nContentProviderClient: %s\nSyncResult: %s";

        SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss.SSS");
        Date dt = new Date();
        String S = sdf.format(dt); // formats to 09/23/2009 13:53:28.238

        Log.d("DDD", "WOKEN UP!\t " + S );
        Log.d("DDD", String.format(format, account,bundle,account,contentProviderClient.toString(), syncResult));
        Log.d("DDD","------------------------");


    }
}




Java Source Code List

org.jakubczyk.syncandaccoutns.foreignreader.ForeignActivity.java
org.jakubczyk.syncandaccoutns.friendly.FriendlyActivity.java
org.jakubczyk.syncandaccoutns.lib.AccountHelper.java
org.jakubczyk.syncandaccoutns.provider.AccountsActivity.java
org.jakubczyk.syncandaccoutns.provider.AuthenticatorService.java
org.jakubczyk.syncandaccoutns.provider.Authenticator.java
org.jakubczyk.syncandaccoutns.provider.StubProvider.java
org.jakubczyk.syncandaccoutns.provider.SyncAdapter.java
org.jakubczyk.syncandaccoutns.provider.SyncService.java