2 * ownCloud Android client application
4 * @author Bartek Przybylski
5 * @author David A. Velasco
6 * Copyright (C) 2011 Bartek Przybylski
7 * Copyright (C) 2015 ownCloud Inc.
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2,
11 * as published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 package com
.owncloud
.android
.syncadapter
;
24 import android
.app
.Service
;
25 import android
.content
.Intent
;
26 import android
.os
.IBinder
;
29 * Background service for synchronizing remote files with their local state.
31 * Serves as a connector to an instance of {@link FileSyncAdapter}, as required by standard Android APIs.
33 public class FileSyncService
extends Service
{
35 // Storage for an instance of the sync adapter
36 private static FileSyncAdapter sSyncAdapter
= null
;
37 // Object to use as a thread-safe lock
38 private static final Object sSyncAdapterLock
= new Object();
44 public void onCreate() {
45 synchronized (sSyncAdapterLock
) {
46 if (sSyncAdapter
== null
) {
47 sSyncAdapter
= new FileSyncAdapter(getApplicationContext(), true
);
56 public IBinder
onBind(Intent intent
) {
57 return sSyncAdapter
.getSyncAdapterBinder();