Under what circumstances would using AIDL to define a service interface be the correct decision (rather than just creating an extension to the service
class)?
views:
89answers:
2
+1
A:
Merely extending a service class will not allow your service to expose its methods to outside entities. If you want your service to be exposed/used by code which runs out of your android app, you will have to define an AIDL for it. This AIDL will be shared and be formed as contract for your service. Refer this http://developer.android.com/guide/developing/tools/aidl.html.
Tushar Tarkas
2010-07-26 13:38:52
But assuming only your app makes use of the service, there is no reason to use aidl - is that correct?
MalcomTucker
2010-07-26 13:49:24
Correct. But then why would you like to create a service in that case either.
Tushar Tarkas
2010-07-26 13:53:53
I created a local service in my app to do a bigger download. In that way I could have some more control and security then just an Async Task that can be killed all every time. As I understand a service that is bound to an activity is not that likely to be killed if resources are scarce.
Janusz
2010-07-26 14:11:18
A:
You need to use AIDL if you want a class outside of your application's process to access the Service. If you're only using the service from inside your application, you can use a local service.
Erich Douglass
2010-07-26 14:15:27