Read and write permissions for Android ContentProvider

permissions don't seem to make any difference ...

In the manifest, I have only one <uses-permission> ( permission.INTERNET ), and I have two <permission> elements:

 <permission android:name="myapp.permission.READ" android:permissionGroup="myapp.permission-group.MYAPP_DATA" android:label="@string/perm_read" android:description="@string/perm_read_summary" android:protectionLevel="signature" /> <permission android:name="myapp.permission.WRITE" android:permissionGroup="myapp.permission-group.MYAPP_DATA" android:label="@string/perm_write" android:description="@string/perm_write_summary" android:protectionLevel="signature" /> 

And then there is the provider:

  <provider android:name=".data.DataProvider" android:multiprocess="true" android:authorities="myapp.data.DataProvider" android:readPermission="myapp.permission.READ" android:writePermission="myapp.permission.WRITE" /> 

Now I have normal access to ContentProvider and it works fine.

  • Why does this work if I did not perform actions with <uses-permission> ? If it is not necessary, also in the application, where the supplier announced?

  • Adding <uses-permission> with my own permissions doesn't matter. Permissions are not even listed in the application information. Why?

ps .: yes, I read questions here about SO and in Google groups (those that Hackborn also answers). I followed (as you can see) what is described everywhere, but still ... You can say that it works, but the fact is that I want to see when it is not.

+6
source share
1 answer

Is it also necessary in the application in which the provider is declared?

AFAIK, your own application contains all of your own permissions that you declare. Third parties will require <uses-permission> .

Permissions are not even listed in the application information. Why?

See above.

You could say that it works, but the point is what I want to see when it is not.

Write another application in your package to check your permissions.

+5
source

Source: https://habr.com/ru/post/895506/


All Articles