Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BREAKING CHANGE: Remove permissions from library and instead require users to add them #148

Merged
merged 1 commit into from
Jun 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ExampleApp/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
package="com.reactnativeaudiotoolkit.exampleapp">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
android:name=".MainApplication"
Expand Down
8 changes: 1 addition & 7 deletions android/lib/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,5 @@
android:versionCode="1"
android:versionName="1.0">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<uses-sdk android:targetSdkVersion="24" />
<uses-sdk android:targetSdkVersion="28" />
</manifest>
27 changes: 21 additions & 6 deletions docs/SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,38 @@ an actual Android/iOS device:
}
```

4. (optional) If you wish to record audio, add the following permissions to
`android/app/src/main/AndroidManifest.xml`
4. (optional) Doing specific tasks with this library requires adding permissions to your
Android manifest file, which can be found at `android/app/src/main/AndroidManifest.xml`

```xml
<manifest ...>

<!-- If you want to play audio from a SD card (i.e. external storage),
you need to add this permission -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<!-- If you want to play audio from a URL, you need to add these permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<!-- If you want to record audio, you need to add this permission -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />

<!-- If you want to record audio to a SD card (i.e. external storage),
you need to add this permission -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
...

</manifest>
```

This is to get permissions for recording audio and writing to external storage.

TODO: Android 6.0 permissions model once supported by React Native:
https://facebook.github.io/react-native/docs/known-issues.html#android-m-permissions
For versions of Android earlier than Android 6.0, the user is asked to agree to permission
when installing the app. However, on Android 6.0+ the app developer is responsible for
asking for permissions before they are required.

For an example of this in action, check out the code in the ExampleApp at
`ExampleApp/src/App.js` or check out the documentation for
[PermissionsAndroid](https://facebook.github.io/react-native/docs/permissionsandroid).

### iOS setup

Expand Down