Android Open Source - groceryviewer Grocery Viewer Sync Service






From Project

Back to project page groceryviewer.

License

The source code is released under:

GNU General Public License

If you think the Android project groceryviewer 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 com.github.knrajago.groceryviewer.services;
/*  w w w  . ja v  a 2 s  . com*/
import com.github.knrajago.groceryviewer.syncadapters.GoogleSpreadsheetRefresher;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

public class GroceryViewerSyncService extends Service {

  public GroceryViewerSyncService() {
  }
  
  // Storage for an instance of the sync adapter
    private static GoogleSpreadsheetRefresher 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 GoogleSpreadsheetRefresher(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

android.UnusedStub.java
com.github.knrajago.groceryviewer.GroceryViewerActivity.java
com.github.knrajago.groceryviewer.constants.GroceryViewerConstants.java
com.github.knrajago.groceryviewer.listadapters.GroceryListAdapter.java
com.github.knrajago.groceryviewer.localdb.GroceryListHelper.java
com.github.knrajago.groceryviewer.observers.GroceryViewerObserver.java
com.github.knrajago.groceryviewer.providers.GroceryViewerContentProvider.java
com.github.knrajago.groceryviewer.services.GroceryViewerSyncService.java
com.github.knrajago.groceryviewer.syncadapters.GoogleSpreadsheetRefresher.java
com.github.knrajago.groceryviewer.threadedutils.GoogleAuthTokenRetriever.java
com.github.knrajago.groceryviewer.utils.GroceryViewerUtils.java