Search code examples
javaandroiddatabaseserviceintentservice

Service vs IntentService for database remote operations


I'm writing a service app which performs operations on a sqlite database and some client apps that are privileged to do different operations via connecting to that app using AIDL interface and ServiceConnection/bindService My concern is concurrency because these operations happen too frequently in order of 100 milliseconds. I don't need communication of client applications with service right now but it might be handy in future. What is best option to do this? Service, IntentService or a subclass of service with similar modification to Intentservice?


Solution

  • You should use ContentProvider for this kind of job. You are afraid of transaction data size, but all components communicate with others through AIDL under the hood, so ContentProvider has the same restriction with size of Parcelable that you can pass through AIDL to service. This size can be different on different API's