Regarding to following situation, can any expert give me some suggestions that whether should I use Content Provider or Service.
Use case: I'm developing two applications (say consumer and producer). 1. when the phone powers up, consumer will read a collection of item names, which are provided by producer. These item names are predefined in producer at compile time and they will not be changed at runtime. 2. For each item, consumer can request the detail information from producer by specifying the item name at anytime. Please note that the item detail information is changed dynamically at runtime. producer has the responsibility to maintain each item detail information. 3. From consumer point of view, all the items provided by producer are read only. consumer will never add, insert or delete these items. 4. In later phase, we may have more producers. The new producers will provide and maintain more new items. I have figured out two solutions: solution1 (content provider): For case1, since the item names are static information, I can put them into AndroidManifest.xml of producer. In this way, consumer can get all the items name even without launching producer. For case2, I can implement a content provider in producer. consumer will use the content provider to access the item detail information. For case4, all producers supported the content URI with same prefix. For example producer1 supports "producer.items.xxx", while producer2 supports "producer.items.yyy". In this way, consumer app can easily query all the producers. Solution2(Service): For case1: same to solution1. For case2: I can implement a service in producer. Consumer can firstly bindService and call the service method to access the item detail information. My question is which solution should I choose, considering following aspects: 1. Design principle of Content Provider and Service 2. Performance of Content Provider and Service. 3. Extensible and maintainable. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---