Allow users to only access certain tables in my content provider

会有一股神秘感。 提交于 2019-12-11 11:47:41

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!