react-native-zeroconf icon indicating copy to clipboard operation
react-native-zeroconf copied to clipboard

Automatic permissions

Open jjv360 opened this issue 6 years ago • 4 comments

Forgive me if there's a reason for this, but can the permissions not be added to this library's android/src/main/AndroidManifest.xml ? Then this library would be able to be installed and linked automatically without any changes to the app's android folder (which is recreated often in my case)...

I'm talking about these:

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />

jjv360 avatar Jun 29 '19 11:06 jjv360

I'm not an Android developer, so I don't really know what is the standard for this (if you can show examples of big libs or resources it would be nice), but wouldn't it be bad that we stealthy grant these at the library level? When doing it the current way there are no surprises to the developer is the thing I can see, but I'm open to change

balthazar avatar Jun 29 '19 16:06 balthazar

Judging by these docs I think it's fine to include automatic permissions, as long as there's a warning in the readme...

2: Pay attention to permissions required by libraries. When you include a library, you also inherit its permission requirements. You should be aware of what you're including, the permissions they require, and what those permissions are used for.

This bluetooth lib and this file system lib also do it this way it seems.

jjv360 avatar Jul 01 '19 04:07 jjv360

https://github.com/Polidea/react-native-ble-plx#android-example-setup it stills requires you to add the permissions manually though, so not sure of the utility

balthazar avatar Jul 01 '19 05:07 balthazar

The other one doesn't, but if you are not comfortable with it that's fine, it's not too much trouble to add them manually every time...

jjv360 avatar Jul 02 '19 09:07 jjv360