flutter_photo_manager icon indicating copy to clipboard operation
flutter_photo_manager copied to clipboard

[Feature request] Create Album in Android gallery

Open emreerkaslan opened this issue 2 years ago • 3 comments

Platforms

Android

Description

Creating album works in ios. As far as I made my research I could not find any legit way to create custom album in android gallery. Other apps like instagram or whatsapp does it, they have their albums named after them. I can create album by using paths such as '/storage/self/primary/Pictures/MyAppAlbumName' or '/storage/emulated/0/Pictures/MyAppAlbumName' but I am not sure if it will work on majority of devices. Anyway is there a way to do it with this plugin, can it be done? It would be cool since I use this plugin for many other functionality as well.

Why

I will utilize it so that when user saves image from app to gallery, those images will be under a folder to be found easily later. It will be more organized as well.

emreerkaslan avatar Jan 17 '24 20:01 emreerkaslan

any update?

omermustekiin avatar Oct 06 '24 20:10 omermustekiin

Saving assets to an album can be implemented, but creating an album only means creating a folder that contains zero assets, which the library can only obtain until it has assets stored in it.

AlexV525 avatar Oct 07 '24 02:10 AlexV525

Hello,

Try this, it worked for me; I created a folder named "testphotofolder"

        ContentValues values = new ContentValues();
        values.put(MediaStore.MediaColumns.DISPLAY_NAME, folderName.toString());
        values.put(MediaStore.MediaColumns.MIME_TYPE, "image/jpeg");
        values.put(MediaStore.MediaColumns.RELATIVE_PATH,"Pictures/testphotofolder");

        if (getActivity().getContentResolver().insert(MediaStore.Images.Media.getContentUri("external"), values) != null) {
            Toast.makeText(getActivity(), "Folder created: ", Toast.LENGTH_SHORT).show();
        } 

I also added the necessary permissions to access the media storage, but this depends on your target version.

NarymaneNanou avatar Dec 20 '24 23:12 NarymaneNanou