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 М.
Share Photos & Files Using FileProvider
12:56
AndroidTutorials
Рет қаралды 16 М.
HOW DID HE WIN? 😱
00:33
Topper Guild
Рет қаралды 40 МЛН
WHO LAUGHS LAST LAUGHS BEST 😎 #comedy
00:18
HaHaWhat
Рет қаралды 18 МЛН
THEY WANTED TO TAKE ALL HIS GOODIES 🍫🥤🍟😂
00:17
OKUNJATA
Рет қаралды 21 МЛН
버블티로 체감되는 요즘 물가
00:16
진영민yeongmin
Рет қаралды 120 МЛН
Git for Software Engineers - Repositories & Commits & Tricks
23:19
Native Mobile Bits
Рет қаралды 695
Everything about storage on Android
12:17
Android Developers
Рет қаралды 18 М.
Save Files with Media Store (Android Tutorial)
18:29
Ahmed Guedmioui
Рет қаралды 945
Run a Repeatable Work from the Background using WorkManager
12:26
FileProvider Android: Sharing Audio Files
10:52
AndroidTutorials
Рет қаралды 3,2 М.
Preferences DataStore in 10min (SharedPreferences deprecated)
11:14
Philipp Lackner
Рет қаралды 73 М.
HOW DID HE WIN? 😱
00:33
Topper Guild
Рет қаралды 40 МЛН