Create a FileProvider to store an image on Android

  Рет қаралды 5,489

Brandan Jones

Brandan Jones

2 жыл бұрын

Create a FileProvider that we can pass to the Camera intent to store an image locally on an Android device/SD Card. I start by giving an overview of why we need to create a FileProvider. A FileProvider can give us a content:// URI, which has more granular permissions than a file:// URI. That is, a content URI can have permissions shared via an intent, where a File can only have permissions set at the File level: all applications get the same permission. After that, I cover android:name, android:authorities, androidx.core.content.FileProvider, android:exported, android:grantUriPermissions, and creating a file_paths.xml file that contains the paths where we want to store our images.

Пікірлер: 5
@JadenAllen
@JadenAllen 2 жыл бұрын
So I should be able to use this to open a file that will be opened with an external app? I'm generating a .zip file and I need to be able to open it with a file explorer with a button
@BaldingEagle51
@BaldingEagle51 10 ай бұрын
On the documentation page for FileProvider, it specifically states that you should extend FileProvider, or your app might crash. Since you use AndroidX's FileProvider, you don't do that here.
@kamertonaudiophileplayer847
@kamertonaudiophileplayer847 Жыл бұрын
Thanks for the great guide. You need to update it only for Android 13, because permissions are changed.
@discospiff
@discospiff Жыл бұрын
Damn, it's already changed? I just made this video a few months ago. ;) That's the nature of Android development.
@kamertonaudiophileplayer847
@kamertonaudiophileplayer847 Жыл бұрын
@@discospiff More likely yes, because I do something like: String stragePermission = Utils.android13()?Manifest.permission.READ_MEDIA_AUDIO:Manifest.permission.READ_EXTERNAL_STORAGE; and it has a separate permission for images.
Uris (Unique Resource Identifier) - Android Basics 2023
14:21
Philipp Lackner
Рет қаралды 22 М.
Create a FileProvider and provider path XML in Android
7:49
Brandan Jones
Рет қаралды 27 М.
Vivaan  Tanya once again pranked Papa 🤣😇🤣
00:10
seema lamba
Рет қаралды 34 МЛН
When You Get Ran Over By A Car...
00:15
Jojo Sim
Рет қаралды 24 МЛН
I CAN’T BELIEVE I LOST 😱
00:46
Topper Guild
Рет қаралды 108 МЛН
Share Photos & Files Using FileProvider
12:56
AndroidTutorials
Рет қаралды 16 М.
Save Files with Media Store (Android Tutorial)
18:29
Ahmed Guedmioui
Рет қаралды 945
Git for Software Engineers - Repositories & Commits & Tricks
23:19
Native Mobile Bits
Рет қаралды 695
Everything about storage on Android
12:17
Android Developers
Рет қаралды 18 М.
Run a Repeatable Work from the Background using WorkManager
12:26
Android Unit Test Tutorial - Writing Your First Unit Test
11:19
Simplified Coding
Рет қаралды 69 М.
Capture picture from camera - Android Studio Tutorial
23:54
The Code City
Рет қаралды 57 М.