问题
I'm planning the database for my app.
I would like to allow others to use my data. However, I only want them to access a couple tables. Is it possible to only allow other apps to access certain tables?
Having all my db code in one place (content provider) just seems like a good idea, rather than having to split it up.
What would be considered best practice?
回答1:
In your Android Manifest file you should for your content provider tag set an attribute grandUriPermissions to false. Thus, you will protect all data of your content provider from access. After that inside <provider> </provider> you should add tag <grant-uri-permission>. About its attribute you can read here. (Your case, I guess, is pathPrefix attribute)
来源:https://stackoverflow.com/questions/11417680/allow-users-to-only-access-certain-tables-in-my-content-provider