react-native-cordova-plugin icon indicating copy to clipboard operation
react-native-cordova-plugin copied to clipboard

Colliding Permissions That Depend on Package Name

Open c-h- opened this issue 8 years ago • 1 comments

Some plugins add permissions that depend on package names. One is Pushwoosh Push Notification Plugin.

Example permission:

<permission android:name="$PACKAGE_NAME.permission.C2D_MESSAGE"  android:protectionLevel="signature" />

As I understand it, the activity io.cordova.reactnative.cordovaplugin is the one actually registering these plugin permissions.

The problem is when multiple apps are installed that use this package to add React Native plugins, since then multiple apps will have the same permission name. When this happens, installation fails.

Do you have any suggestions of how to namespace these permissions better?

Ideas:

  • Access the React Native project's MainActivity package name to set $PACKAGE_NAME somehow
  • Use a variable passed in when installing the plugin to set $PACKAGE_NAME (e.g. /cordova-plugin add ___ --variable PACKAGE_NAME="com.some.package")

I'm not sure how feasible the ideas above are, but if I get some feedback I can look into working on this (I need this resolved myself).

Thanks!

c-h- avatar May 17 '16 17:05 c-h-

My solution so far is to manually update the C2D permissions in:

  • platforms/android/AndroidManifest.xml
  • platforms/android/android.json

To get the correct package ID set.

c-h- avatar May 17 '16 20:05 c-h-