开发者

Can android content provider be used for simple data such as name:value pairs

开发者 https://www.devze.com 2023-02-08 08:46 出处:网络
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 i

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消