Module: LCKAndroidGallery | Version: 1.0 | Platforms: Android only
Overview
LCKAndroidGallery provides functions to save recorded videos and captured photos to the Android device’s media gallery. Files are published through the Android MediaStore API, making them visible in the device’s gallery app and accessible to other applications. Videos are saved toMovies/<GameName>/ and images to Pictures/<GameName>/, where <GameName> is read from your LCK project settings (falling back to the Unreal project name).
When to Use
Use these functions after:- A recording completes via
StopRecording()orStopRecordingAsync()to save the video to the user’s gallery - A photo is captured via
TakePhoto()to save the image to the user’s gallery
Files saved through LCKAndroidGallery appear immediately in the device gallery app. Without this step, recorded files remain in the app’s internal storage and are not visible to the user.
Functions
SaveVideoToGallery
Copies a video file to the Android MediaStore and reports copy progress via a callback.| Parameter | Type | Description |
|---|---|---|
VideoPath | const FString& | Absolute path to the source video file (.mp4) |
OnProgress | TFunction<void(float)> | Callback invoked during the file copy with progress from 0.0 to 1.0 |
Movies/<GameName>/<GameName>_<timestamp>.mp4 in the device’s shared storage.
SaveImageToGallery
Copies an image file to the Android MediaStore.| Parameter | Type | Description |
|---|---|---|
ImagePath | const FString& | Absolute path to the source image file (.png) |
Pictures/<GameName>/<GameName>_<timestamp>.png in the device’s shared storage.
Usage Examples
Save Video After Recording
On Android, the encoder’s
Save() method automatically calls SaveVideoToGallery() internally. You do not need to call it manually — the video is saved to the Android MediaStore (Gallery) as part of ReleaseEncoder(bSaveFile = true) or StopRecordingAsync(). The temp file is located at FPaths::ProjectPersistentDownloadDir() / TEXT("lck.mp4").Save Photo After Capture
Platform Notes
Permissions
LCKAndroidGallery uses the Android MediaStoreContentResolver API (available on Android 10 / API 29+), which does not require runtime storage permissions for writing to shared media directories.
For devices running Android 9 (API 28) or earlier, you need:
File Naming
Saved files follow the naming convention:GameName in LCKSettings). If not configured, the Unreal project name is used as a fallback.
Dependencies
Log Category
Troubleshooting
File does not appear in gallery
File does not appear in gallery
- Verify the source file path exists before calling the save function
- Check
LogLCKGalleryfor error messages - Ensure the device is running Android 10+ or that
WRITE_EXTERNAL_STORAGEpermission is granted
Save fails with JNI error
Save fails with JNI error
- Confirm you are calling from the game thread
- Check that the Android activity is valid and not suspended
- Review logcat output for Java exceptions
Progress callback not firing
Progress callback not firing
- Verify the
OnProgresscallback is valid (not null) - The callback fires per 4KB chunk — very small files may complete in a single call