3

I'm using a service inside a library project. When I'm starting the service (using context.startService(service)) the onStart() of the service never reached. I'm doing something wrong, and I have some lead questions:

  1. In which manifest file I should declare the service (library project or the APK project) ?

  2. Does it have any connection to remote services and AIDL? I'm not so sure about it but I found this answer Android service in library and it seems wired that I have to create AIDL in the same application where I don't have any Inter Process Communication (IPC).

  3. I tried to extend the library service in my APK project and declare it in the APK's manifest file - but still the onStart() of service was never reached.

Thanks.

Community
  • 1
  • 1
micnoy
  • 3,926
  • 4
  • 24
  • 27

1 Answers1

-1

The onStart() method was deprecated in API level 5 so on android 2.0 or later onStart() would not be called, you need to implement onStartCommand(Intent, int, int) instead..

Update: AS @David Wasser pointed out my silly mistake.. Can you check that you are not overriding the onStartCommand() method or if you are overriding the onStartCommand() then you are calling the super.onStartCommand() from it.. Please show us some code...

Praful Bhatnagar
  • 7,425
  • 2
  • 36
  • 44
  • 1
    This answer is just plain wrong. `onStart()` has been deprecated, but it is still there and still works. The documentation for `onStartCommand()` specifically states: **"For backwards compatibility, the default implementation calls `onStart(Intent, int)`"** – David Wasser Feb 03 '13 at 15:04
  • 1
    Can you please post your service code and the code you are using to invoke the service... – Praful Bhatnagar Feb 03 '13 at 17:30