Fabian
Fabian

Reputation: 175

Android Service do not start if it is in a library project

I have a project in which I need a listener service. Everything works fine. But the service is also necessary in other projects. So I created a library project in which I add the service. But now the service does not start any more.

I start it like before:
Intent intent = new Intent(this.getApplicationContext(), MyService.class);
this.startService(intent);

The service does not react on the event. I put also in onCreate(), onStart() and onStartCommand() a log entry(Log.d(„MyApp“,“iamhere“)) to see if it even starts. But there is also nothing in the log.

I can use other classes out of the Library project.

What do I have to do to use the service?

Thanks and best regards

Upvotes: 1

Views: 1092

Answers (1)

Izvorski
Izvorski

Reputation: 146

Add it on manifest as suggested. You can also use Broadcast Receivers. Or the type of service you need.

Upvotes: 2

Related Questions