I would like to add to my app the functionality "unread SMS count" which off course requires a new Android permissions, since not all my users will need that functionality I'd like to distribute it as a plugin in order to avoid having too many permissions on the main app.

Application is already in the market and i did not specify an "UID" when i first published it so the shared "UID" space is not an option.

So question is, which is the best way to do this? Is an AIDL remote service the only option i have? Is there any simpler solution?

有帮助吗?

解决方案

Is an AIDL remote service the only option i have?

No.

Is there any simpler solution?

Create a ContentProvider proxy for the (undocumented and unsupported) ContentProvider that you are trying to access.

The projects in this directory demonstrate such a proxy and a consumer of that proxy. In my case, I am proxying the CallLog, but the same concept applies for any ContentProvider.

The keys are:

  • Have the plugin hold the desired permission for the ContentProvider it is proxying

  • Have both the app and the plugin define a custom signature-level permission to be used by such plugins (<permission>)

  • Have the app hold that permission (<uses-permission>)

  • Have the plugin protect the ContentProvider proxy via that custom permission (android:permission)

This will allow your app to access the plugin's ContentProvider proxy, while not leaking the capability of accessing the proxied ContentProvider to others.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top