Created
May 21, 2012 13:31
-
-
Save Axxiss/2762338 to your computer and use it in GitHub Desktop.
Sync service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SyncService extends Service { | |
/** Lock to synchronize access to SyncAdapter*/ | |
private static final Object syncLock = new Object(); | |
/** SyncAdapter used to sync data with server */ | |
private static SyncAdapter sSyncAdapter = null; | |
@Override | |
public void onCreate(){ | |
synchronized(syncLock) | |
{ | |
if(sSyncAdapter == null) | |
sSyncAdapter = new SyncAdapter(getApplicationContext(), true); | |
} | |
} | |
@Override | |
public IBinder onBind(Intent arg0) { | |
return sSyncAdapter.getSyncAdapterBinder(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment