Courtesy of Android Studio's manifest merger process, this library will automatically add some permissions to your app's manifest:
CAMERA
WRITE_EXTERNAL_STORAGE
RECORD_AUDIO
Most apps using this library will need these permissions. However, there are other considerations you may need to take into account for your apps with respect to permissions.
On Android 6.0+, all three of the permissions listed above are
considered dangerous
permissions and therefore are subject to the
new runtime permission system. That means that not only do you
need the <uses-permission>
element in the manifest for the permission,
but you need to ask the user for the permission at runtime, until
the user grants it (or tells you to stop asking).
By default, the library will not request these runtime permissions. This logic should be in the app, not the library, as you will need to deal with the cases where the user declines the permission. The library will check to see if the permissions have been granted, and if they have not, the library will fail quickly.
If you really want the library to handle these permissions,
call requestPermissions()
on the IntentBuilder
that you are using.
In that case, the library will handle some bare-bones work related to this,
asking the user for CAMERA
and RECORD_AUDIO
.
This documentation is not designed to provide complete instructions for using the runtime permission system. Please refer to the official documentation or the author's book for more details.
The demo
app implements a fairly rudimentary check for
runtime permissions. The demo-playground
app has
a SwitchPreference
for controlling whether requestPermissions()
is
called; the app will crash if that Switch
is not on and you try taking a
picture or recording a video.
If you do not intend to take videos, you could get away without
the RECORD_AUDIO
and perhaps the WRITE_EXTERNAL_STORAGE
permissions (depending on where you are saving the photos).
To remove those from your app's manifest, add
the following elements to your manifest, as children of the
root <manifest>
element:
<uses-permission
android:name="android.permission.RECORD_AUDIO"
tools:node="remove"/>
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:node="remove"/>
This tells the manifest merger process that while one or more libraries might be asking for these permissions, block them from the app's manifest generated by the merger.