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