Requesting read permission from my own ContentProvider in another app

后端 未结 1 1602
闹比i
闹比i 2021-01-12 16:38

In one app, I have the following content provider declared in my AndroidManifest:

    

        
1条回答
  •  既然无缘
    2021-01-12 16:51

    In the app defining your ContentProvider, did you also define the permission you are requiring/requesting(in your other app)? Like so (within the root tag):

    
    

    In general, you need to:

    1. define the permission in one of your apps' manifest files
    2. request the permission in any of your apps' manifest files, for apps that wish to get the permission
    3. require this permission in any component that you wish to guard with this permission, like Activities, Services, or ContentProviders (read, write, both, specific sub-URIs, etc)

    Edit: so just to be 100% clear, it is NOT enough to "implicitly" define a permission by requiring it in, say, your ContentProvider. You have to define it explicitly in your app's manifest file (within the tag).

    0 讨论(0)
提交回复
热议问题