Android Open Source - Backend Sync Service

From Project

Back to project page


The source code is released under:

Apache License

If you think the Android project 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 nl.fhict.intellicloud.answers.backendcommunication;
/*from w ww  .ja  v a 2 s  .c om*/
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;

public class BackendSyncService extends Service {
      // Storage for an instance of the sync adapter
      private static BackendSyncAdapter syncAdapter = null;
      // Object to use as a thread-safe lock
      private static final Object sSyncAdapterLock = new Object();
      public BackendSyncService()
       * Instantiate the sync adapter object.
      public void onCreate() {
           * Create the sync adapter as a singleton.
           * Set the sync adapter as syncable
           * Disallow parallel syncs
          synchronized (sSyncAdapterLock) {
              if (syncAdapter == null) {
                Log.d("SyncService", "Sync service started");
                  syncAdapter = new BackendSyncAdapter(getApplicationContext(), true);
       * Return an object that allows the system to invoke
       * the sync adapter.
      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 syncAdapter.getSyncAdapterBinder();

Java Source Code List