1 | # expo-permissions
|
2 |
|
3 | Allows you prompt for various permissions to access device sensors, personal data, etc.
|
4 |
|
5 | # API documentation
|
6 |
|
7 | - [Documentation for the master branch](https://github.com/expo/expo/blob/master/docs/pages/versions/unversioned/sdk/permissions.md)
|
8 | - [Documentation for the latest stable release](https://docs.expo.io/versions/latest/sdk/permissions/)
|
9 |
|
10 | # Installation
|
11 |
|
12 | This package is pre-installed in [managed](https://docs.expo.io/versions/latest/introduction/managed-vs-bare/) Expo projects. You may skip the rest of the installation guide if this applies to you.
|
13 |
|
14 | For bare React Native projects, you must ensure that you have [installed and configured the `@unimodules/core` package](https://github.com/unimodules/core) before continuing.
|
15 |
|
16 | ### Add the package to your npm dependencies
|
17 |
|
18 | ```
|
19 | npm install expo-permissions
|
20 | ```
|
21 |
|
22 | ### Configure for iOS
|
23 |
|
24 | Add the dependency to your `Podfile` and then run `pod install`.
|
25 |
|
26 | ```ruby
|
27 | pod 'EXPermissions', path: '../node_modules/expo-permissions/ios'
|
28 | ```
|
29 |
|
30 | ### Configure for Android
|
31 |
|
32 | 1. Append the following lines to `android/settings.gradle`:
|
33 |
|
34 | ```gradle
|
35 | include ':expo-permissions'
|
36 | project(':expo-permissions').projectDir = new File(rootProject.projectDir, '../node_modules/expo-permissions/android')
|
37 | ```
|
38 |
|
39 | 2. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
|
40 | ```gradle
|
41 | api project(':expo-permissions')
|
42 | ```
|
43 |
|
44 | 3. In `MainApplication.java`, import the package and add it to the `ReactModuleRegistryProvider` list:
|
45 | ```java
|
46 | import expo.modules.expo.modules.permissions.PermissionsPackage;
|
47 | ```
|
48 | ```java
|
49 | private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(Arrays.<Package>asList(
|
50 | // Your other packages will be here
|
51 | new PermissionsPackage()
|
52 | ), Arrays.<SingletonModule>asList());
|
53 | ```
|
54 |
|
55 | # Contributing
|
56 |
|
57 | Contributions are very welcome! Please refer to guidelines described in the [contributing guide]( https://github.com/expo/expo#contributing).
|