0

Is it possible to programatically set the protection level of an IntentFilter/Intent in java similar to how we can define it in the AndroidManifest.xml:

<receiver
    android:name="my.test.receiver"
    android:protectionLevel="signature" />

We have a core library for our apps which facilitates dynamic broadcasts and receivers at runtime and we would like to make them secure here.

I have found no information on this method online and not sure if it is possible. if we could set an intentFilters permission level = PermissionInfo.PROTECTION_SIGNATURE it would work but going by the docs it seems PermissionInfo is only used for reading. The only alternative method I can find is declaring a special permission, sending it with our broadcasts and adding it to all our manifests: https://stackoverflow.com/a/15316487/1810256

We may fall back on this approach but we would prefer the first method as the signature approach seems more secure.

Any help/suggestions appreciated!

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Bryan
  • 23
  • 6

1 Answers1

-3

Quoting one of the users(Naveed Ahmad): "Guys now from Android 6.0 Marshmellow onward, you can ask users at runtime to allow permissions dynamically, I found of it, have a look at this link. I hope it will help you getting idea."

https://inthecheesefactory.com/blog/things-you-need-to-know-about-android-m-permission-developer-edition/en

I found it in here: get Android permission dynamiclly

Community
  • 1
  • 1
SAM_U_RAI
  • 65
  • 6