diff --git a/AndroidManifest.xml b/AndroidManifest.xml index f8c1d8e19..ede5cb2f4 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -8,7 +8,7 @@ - + diff --git a/AndroidManifest.xml.pattern b/AndroidManifest.xml.pattern index 6340d3810..9ade34310 100644 --- a/AndroidManifest.xml.pattern +++ b/AndroidManifest.xml.pattern @@ -8,7 +8,7 @@ - + diff --git a/src/org/geometerplus/android/fbreader/FBReaderApplication.java b/src/org/geometerplus/android/fbreader/FBReaderApplication.java new file mode 100644 index 000000000..27e442b40 --- /dev/null +++ b/src/org/geometerplus/android/fbreader/FBReaderApplication.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2007-2012 Geometer Plus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +package org.geometerplus.android.fbreader; + +import android.content.Intent; + +import org.geometerplus.zlibrary.ui.android.library.ZLAndroidApplication; +import org.geometerplus.android.fbreader.libraryService.LibraryService; + +public class FBReaderApplication extends ZLAndroidApplication { + @Override + public void onCreate() { + super.onCreate(); + bindService(new Intent(this, LibraryService.class), null, LibraryService.BIND_AUTO_CREATE); + } +} diff --git a/src/org/geometerplus/android/fbreader/libraryService/LibraryService.java b/src/org/geometerplus/android/fbreader/libraryService/LibraryService.java index b6439b0d5..afd79b9f6 100644 --- a/src/org/geometerplus/android/fbreader/libraryService/LibraryService.java +++ b/src/org/geometerplus/android/fbreader/libraryService/LibraryService.java @@ -24,6 +24,17 @@ import android.content.Intent; import android.os.IBinder; public class LibraryService extends Service { + @Override + public void onStart(Intent intent, int startId) { + onStartCommand(intent, 0, startId); + } + + @Override + public int onStartCommand(Intent intent, int flags, int startId) { + System.err.println("LibraryService started for intent " + intent); + return START_STICKY; + } + @Override public IBinder onBind(Intent intent) { System.err.println("LibraryService binded for intent " + intent); diff --git a/src/org/geometerplus/zlibrary/ui/android/library/ZLAndroidApplication.java b/src/org/geometerplus/zlibrary/ui/android/library/ZLAndroidApplication.java index c0b897b2b..80921200c 100644 --- a/src/org/geometerplus/zlibrary/ui/android/library/ZLAndroidApplication.java +++ b/src/org/geometerplus/zlibrary/ui/android/library/ZLAndroidApplication.java @@ -26,7 +26,7 @@ import org.geometerplus.zlibrary.core.sqliteconfig.ZLSQLiteConfig; import org.geometerplus.zlibrary.ui.android.application.ZLAndroidApplicationWindow; import org.geometerplus.zlibrary.ui.android.image.ZLAndroidImageManager; -public class ZLAndroidApplication extends Application { +public abstract class ZLAndroidApplication extends Application { public ZLAndroidApplicationWindow myMainWindow; @Override