Files
moasdawiki-app/app/src/main/java/net/moasdawiki/app/CalendarSyncAdapterService.java
T
2021-12-25 15:51:36 +01:00

46 lines
1.4 KiB
Java

/*
* MoasdaWiki App
* Copyright (C) 2008 - 2022 Herbert Reiter (herbert@moasdawiki.net)
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3 as published
* by the Free Software Foundation (GPL-3.0-only).
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/gpl-3.0.html>.
*/
package net.moasdawiki.app;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import org.jetbrains.annotations.Nullable;
public class CalendarSyncAdapterService extends Service {
private static CalendarSyncAdapter syncAdapter = null;
private static final Object syncAdapterLock = new Object();
@Override
public void onCreate() {
synchronized (syncAdapterLock) {
if (syncAdapter == null) {
syncAdapter = new CalendarSyncAdapter(getApplicationContext(), true, false);
}
}
}
@Nullable
@Override
public IBinder onBind(Intent intent) {
return syncAdapter.getSyncAdapterBinder();
}
}