PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV Mobile 2024 → [WM 26] Android 11 access to device photo album
[WM 26] Android 11 access to device photo album
Started by Claire, Apr., 21 2022 7:32 PM - No answer
Registered member
48 messages
Posted on April, 21 2022 - 7:32 PM
I have a button in my app that is supposed to open up the device photo album so that you can select an image from your photos. With Android 11, it seems like AlbumPicker doesn't work? I've tried a few methods listed like adding in a notification and what not but I can't seem to find anything that works. All I need is for the button to open up the photo album on the device and allow you to select a photo. Then the rest of the code creates a copy of the image and adds it in the app. It's worked just fine up until now (Android 11)

Below is my original code...

sTempPhoto is string
sReducedSizePhoto is string
sThumb is string

sTempPhoto = ""
sTempPhoto = AlbumPicker()


IF sTempPhoto = "" THEN
Error(ErrorInfo())
RETURN
END

HourGlass(True)
ProcessPhoto(sTempPhoto)

EXPRESS_WIN_REPORT.IMG_TMP = sTempPhoto


sReducedSizePhoto = gsTempDir + "r500kb_" + DateSys() + "_" + TimeSys() + ".jpg"
IF fSize(sTempPhoto) > 500000 THEN //bytes
IF dSaveImageJPEG(EXPRESS_WIN_REPORT.IMG_TMP,sReducedSizePhoto,50) = False THEN
Error(ErrorInfo())
END
ELSE
fCopyFile(sTempPhoto, sReducedSizePhoto)
END
//fDelete(sTempPhoto)

sThumb = EXPRESS_WIN_REPORT.GiveMiniatureName(sReducedSizePhoto)
CreateMiniature(sReducedSizePhoto,sThumb)

IF gnCurrentObsPicturesTaken = 0 THEN
gsTempPhoto1 = sReducedSizePhoto
EXPRESS_WIN_REPORT.IMG_Photo1 = sThumb
ELSE
gsTempPhoto2 = sReducedSizePhoto
EXPRESS_WIN_REPORT.IMG_Photo2 = sThumb
END

HourGlass(False)

gnTotalPicturesTaken = gnTotalPicturesTaken + 1
gnCurrentObsPicturesTaken = gnCurrentObsPicturesTaken + 1

EXPRESS_WIN_REPORT.STC_Photo_Counter = "# Saved photos: " + gnTotalPicturesTaken + " Max allowed: 20"

Close(WIN_PHOTO_SOURCE)