2

I have developed a Service in my Android app, that seems to be running fine under the same process as my app. By this I mean that onBind() is called etc and I can communicate with effectively.

The problem is that when I define the process attribute in the Service tag in the manifest the function onBind() is never called.

Why is this? How can I bind to the service when it is running as a separate process?

Please don't ask my to post code as what I have is generic service stuff, the questions is merely on the theory of how Services work on Android. Thanks.

jim
  • 8,670
  • 15
  • 78
  • 149
  • "The problem arises" -- and the problem is... what? Please explain the specific symptoms. If you are crashing, use LogCat to examine the Java stack trace associated with your crash: https://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this "Please don't ask my to post code" -- tough. Please provide a [minimal, complete, and verifiable example](http://stackoverflow.com/help/mcve) along with the more detailed problem statement. – CommonsWare Aug 17 '15 at 15:24
  • what does `bindService` call return? – pskink Aug 17 '15 at 18:00

1 Answers1

1

You need to use android IPC (inter-process-communication) - which means You need to declare your interface file (AIDL - read more here http://developer.android.com/guide/components/aidl.html).

The theory behind this is that when Youre in different processes, they dont share the same memory space. Thus it needs to go through a Binder api. It lets you use some basic data types or Parcelable objects. Otherwise, you can communicate via Intents.

Maciej Boguta
  • 1,354
  • 1
  • 12
  • 15