Can android content provider be used for simple data such as name:value pairs
I am writing a small featurecontrol-application, which has several feature settings stored and managed. All applications use my featurecontrol-application to retrieve settings like whether feature-x is enabled or not or what is feature-x-value . Can I use contentprovider for this or are there any othe开发者_运维百科r alternatives?
If you have several applications, and they have to share same data (content) usage of ContentProvider looks to me as quite good and logical solution.
Content provider is one option to implement communication between different applications. But it does not need DB as a backbone. Instead of DB you can use table of constants. To create ContentProvider you just need to override several functions, no constraint is imposed to use DB.
Another option is to implement IPC via AIDL. That also gives you interface to share objects, but IMO since you just need to share constants ContentProvider is easier and faster solution.
精彩评论