1


I'm working on an app in which I need to implement a download mechanism for multiple items in the same time, In order to achieve maximum efficiency I want to implement it as an AIDL service However I have one thing I struggle to understand - since I can only pass primitives to the service and I need to pass an interface can I pass the interface object in a static method method WITHOUT declaring it on the process? This way I can populate the object on run-time with an actual object.

The reason I am trying to do this is since it is already half implemented with LOCAL listeners in the service that handle different events (Error, Cancel etc..) however after the application get a bind for the service it can pass different URLs to be downloaded and so I need it to listen for different events in order to react to different events (this in a way the listening screens pass themself as an interface on a static method which I do not declare on)

CrazyPixel
  • 41
  • 3
  • there is no such thing like "static AIDL method" – pskink Oct 22 '14 at 15:56
  • That was not my question my question is if I can create a static method in a service that is declared as aidl and pass an interface to it – CrazyPixel Oct 22 '14 at 16:03
  • 1
    of course you can create a static method in your service but it has nothing to do with AIDL, that static method will have (as any other static method) access only to static members of your service – pskink Oct 22 '14 at 16:08
  • Ok, in that case it means that for an example upon a onCancel event I can also trigger the listener.oncancel(int downloadId) assuming listener is the type I am passing to the service on the static method? – CrazyPixel Oct 22 '14 at 16:26
  • sorry, i completely don't understand what you mean... – pskink Oct 22 '14 at 17:12

0 Answers0