Android Open Source - AndroidSyncAndAccounts Sync Service






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;
//www .  j ava 2 s.  co  m
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

public class SyncService extends Service {
    // Storage for an instance of the sync adapter
    private static SyncAdapter sSyncAdapter = null;
    // Object to use as a thread-safe lock
    private static final Object sSyncAdapterLock = new Object();
    /*
     * Instantiate the sync adapter object.
     */
    @Override
    public void onCreate() {
        /*
         * Create the sync adapter as a singleton.
         * Set the sync adapter as syncable
         * Disallow parallel syncs
         */
        synchronized (sSyncAdapterLock) {
            if (sSyncAdapter == null) {
                sSyncAdapter = new SyncAdapter(getApplicationContext(), true);
            }
        }
    }
    /**
     * Return an object that allows the system to invoke
     * the sync adapter.
     *
     */
    @Override
    public IBinder onBind(Intent intent) {
        /*
         * Get the object that allows external processes
         * to call onPerformSync(). The object is created
         * in the base class code when the SyncAdapter
         * constructors call super()
         */
        return sSyncAdapter.getSyncAdapterBinder();
    }
}




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