src/org/gege/caldavsyncadapter/syncadapter/SyncService.java

changeset 0
fb9019fb1bf7
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/org/gege/caldavsyncadapter/syncadapter/SyncService.java	Tue Feb 10 18:12:00 2015 +0100
     1.3 @@ -0,0 +1,46 @@
     1.4 +/**
     1.5 + * Copyright (c) 2012-2013, David Wiesner
     1.6 + * 
     1.7 + * This file is part of Andoid Caldav Sync Adapter Free.
     1.8 + *
     1.9 + * Andoid Caldav Sync Adapter Free is free software: you can redistribute 
    1.10 + * it and/or modify it under the terms of the GNU General Public License 
    1.11 + * as published by the Free Software Foundation, either version 3 of the 
    1.12 + * License, or at your option any later version.
    1.13 + *
    1.14 + * Andoid Caldav Sync Adapter Free is distributed in the hope that 
    1.15 + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied 
    1.16 + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.17 + * GNU General Public License for more details.
    1.18 + *
    1.19 + * You should have received a copy of the GNU General Public License
    1.20 + * along with Andoid Caldav Sync Adapter Free.  
    1.21 + * If not, see <http://www.gnu.org/licenses/>.
    1.22 + * 
    1.23 + */
    1.24 +
    1.25 +package org.gege.caldavsyncadapter.syncadapter;
    1.26 +
    1.27 +import android.app.Service;
    1.28 +import android.content.Intent;
    1.29 +import android.os.IBinder;
    1.30 +
    1.31 +public class SyncService extends Service {
    1.32 +    private static final Object sSyncAdapterLock = new Object();
    1.33 +
    1.34 +    private static SyncAdapter sSyncAdapter = null;
    1.35 +
    1.36 +    @Override
    1.37 +    public void onCreate() {
    1.38 +        synchronized (sSyncAdapterLock) {
    1.39 +            if (sSyncAdapter == null) {
    1.40 +                sSyncAdapter = new SyncAdapter(getApplicationContext(), true);
    1.41 +            }
    1.42 +        }
    1.43 +    }
    1.44 +
    1.45 +    @Override
    1.46 +    public IBinder onBind(Intent intent) {
    1.47 +        return sSyncAdapter.getSyncAdapterBinder();
    1.48 +    }
    1.49 +}

mercurial