Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. public class SyncService extends Service {
  2. // Storage for an instance of the sync adapter
  3. private static SyncAdapter sSyncAdapter = null;
  4. // Object to use as a thread-safe lock
  5. private static final Object sSyncAdapterLock = new Object();
  6. /*
  7. * Instantiate the sync adapter object.
  8. */
  9. @Override
  10. public void onCreate() {
  11. /*
  12. * Create the sync adapter as a singleton.
  13. * Set the sync adapter as syncable
  14. * Disallow parallel syncs
  15. */
  16. synchronized (sSyncAdapterLock) {
  17. if (sSyncAdapter == null) {
  18. sSyncAdapter = new SyncAdapter(getApplicationContext(), true);
  19. }
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement