Content Providers, Authority and URI matching

泄露秘密 提交于 2019-12-11 14:15:19

问题


I've been trying to work on a custom content provider and I have a few questions.

  1. How is the Android framework using Authority property? Why is it required to declare it in the manifest, shouldn't the class name be enough?

  2. Who/what process calls the getType() method in the ContentProvider implementation?

  3. What is the need of the urimatcher? Should it be used if the underlying database has only a handful of tables?


回答1:


You are required to declare it in the manifest because data access permissions are listed in the Market entry. I.E. "Has permission to read contact information".

getType() is called when you want to get the MIMETYPE of a column accessed by a ContentProvider. This is called when you use MyContentProvider.getType(myUri)

Hope this helps!



来源:https://stackoverflow.com/questions/7044893/content-providers-authority-and-uri-matching

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