Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement