Tue, 10 Feb 2015 18:12:00 +0100
Import initial revisions of existing project AndroidCaldavSyncAdapater,
forked from upstream repository at 27e8a0f8495c92e0780d450bdf0c7cec77a03a55.
michael@0 | 1 | /** |
michael@0 | 2 | * Copyright (c) 2012-2013, David Wiesner |
michael@0 | 3 | * |
michael@0 | 4 | * This file is part of Andoid Caldav Sync Adapter Free. |
michael@0 | 5 | * |
michael@0 | 6 | * Andoid Caldav Sync Adapter Free is free software: you can redistribute |
michael@0 | 7 | * it and/or modify it under the terms of the GNU General Public License |
michael@0 | 8 | * as published by the Free Software Foundation, either version 3 of the |
michael@0 | 9 | * License, or at your option any later version. |
michael@0 | 10 | * |
michael@0 | 11 | * Andoid Caldav Sync Adapter Free is distributed in the hope that |
michael@0 | 12 | * it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
michael@0 | 13 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
michael@0 | 14 | * GNU General Public License for more details. |
michael@0 | 15 | * |
michael@0 | 16 | * You should have received a copy of the GNU General Public License |
michael@0 | 17 | * along with Andoid Caldav Sync Adapter Free. |
michael@0 | 18 | * If not, see <http://www.gnu.org/licenses/>. |
michael@0 | 19 | * |
michael@0 | 20 | */ |
michael@0 | 21 | |
michael@0 | 22 | package org.gege.caldavsyncadapter.syncadapter; |
michael@0 | 23 | |
michael@0 | 24 | import android.app.Service; |
michael@0 | 25 | import android.content.Intent; |
michael@0 | 26 | import android.os.IBinder; |
michael@0 | 27 | |
michael@0 | 28 | public class SyncService extends Service { |
michael@0 | 29 | private static final Object sSyncAdapterLock = new Object(); |
michael@0 | 30 | |
michael@0 | 31 | private static SyncAdapter sSyncAdapter = null; |
michael@0 | 32 | |
michael@0 | 33 | @Override |
michael@0 | 34 | public void onCreate() { |
michael@0 | 35 | synchronized (sSyncAdapterLock) { |
michael@0 | 36 | if (sSyncAdapter == null) { |
michael@0 | 37 | sSyncAdapter = new SyncAdapter(getApplicationContext(), true); |
michael@0 | 38 | } |
michael@0 | 39 | } |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | @Override |
michael@0 | 43 | public IBinder onBind(Intent intent) { |
michael@0 | 44 | return sSyncAdapter.getSyncAdapterBinder(); |
michael@0 | 45 | } |
michael@0 | 46 | } |