Question

Here's the scenario: I have developed an Android application that uses other app's ContentProvider. I have the required bits in AndroidManifest.xml file, but using the other app's content is only a feature - the user does not need to install the third-party app and it makes perfect sense to ignore it.

The problem is: when the user decides to install the third-party app to use my software fully, she has no chance granting my app the missing permission, because it wasn't displayed during installation time (Android had no clue about it), and Android won't ask for it again until the software is updated or reinstalled. My app cannot simply start to use the permission as if it was always granted, because:

java.lang.SecurityException: Permission Denial: opening provider X from ProcessRecord{...} (...) requires perm.Y or perm.Z

That's perfectly reasonable, I can catch the exception and the app will continue to work as if the third-app wasn't installed, but it'd be counter-intuitive for the user. The only solution (not quite acceptable) I have found is to ask the user to reinstall my application to be able to grant the permission to the other app.

Était-ce utile?

La solution

The only solution (not quite acceptable) I have found is to ask the user to reinstall my application to be able to grant the permission to the other app.

You can include a <permission> element for the same permission from the third-party app in yours (e.g., perm.Y or perm.Z). Then, you will get the permission at install time, and it will work once the third-party app is installed. The fact that this is possible is bad, and the third-party app may take steps as a result. Hence, in the long term, you may need to negotiate with the third party to make sure that you are doing this in a way that the third party will find acceptable.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top