Is it possible to place the service in a subpackage?

My Service only works if I have MyService.java in a package like

com.test.app

but NOT in a subpackage, for example

com.test.app.services.MyService

In the manifest, I tried to declare it using

<service android:name=".services.MyService" />

or fully qualified

<service android:name="com.test.app.services.MyService" />

but none of the methods worked. I use subpackages to better structure my files. So I really can’t put my service file in a subpackage or am I missing something here?

(I work with the extension library provided by the Android team. This includes the implementation of a simple service.)

+3
source share
2 answers

Yes, you can put it in any namespace you want.

DownloaderService , . :

// Start the download service (if required)
int startResult = DownloaderClientMarshaller.startDownloadServiceIfRequired(this,
                pendingIntent, SampleDownloaderService.class);

, Service .

+1

.

. , - . , , , Intent .

0

All Articles