-
Notifications
You must be signed in to change notification settings - Fork 22
Exported Files Not Visible in Quest Files App Until Restart #6
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
🐛 Bug Description
When using the "Export Data" feature to export recordings to the Quest Downloads folder, the ZIP file is successfully created but does not appear in the Quest Files app until the headset is restarted.
Current Behavior:
- User exports a recording via Y button → Recording Menu → "Export Data"
- Export completes successfully (confirmation message appears)
- User opens Quest Files app → Downloads folder
- ❌ ZIP file is not visible
- User restarts headset
- ✅ ZIP file now appears in Downloads folder
Expected Behavior:
- ZIP file should be immediately visible in Quest Files app after export completes
📍 Location
File: Assets/RealityLog/Scripts/Runtime/FileOperations/RecordingOperations.cs
Export Code (lines ~298-301):
// Move zip to downloads
File.Move(zipPath, destZipPath);
Debug.Log($"[{Constants.LOG_TAG}] RecordingOperations: Exported {directoryName} to {destZipPath}");
OnOperationComplete?.Invoke("Export", true, $"Exported to Downloads: {Path.GetFileName(destZipPath)}. You may need to restart your headset to see the zip file show up in the Downloads folder.");The message already warns users about this issue, but it should be fixed.
🔍 Root Cause (Suspected)
Android's MediaStore is not being notified about the new file. The Quest Files app (and other file browsers) rely on the MediaStore database to list files. When files are written directly to storage without notifying the MediaStore, they won't appear until:
- The headset restarts (triggers a media scan)
- The MediaStore is manually refreshed
✅ Proposed Solution
Trigger a media scan after writing the file to notify Android's MediaStore:
private void ExecuteMoveToDownloads(string directoryName)
{
try
{
// ... existing move code ...
File.Move(zipPath, destZipPath);
// NEW: Notify MediaStore about the new file
#if UNITY_ANDROID && !UNITY_EDITOR
ScanFile(destZipPath);
#endif
Debug.Log($"[{Constants.LOG_TAG}] RecordingOperations: Exported {directoryName} to {destZipPath}");
OnOperationComplete?.Invoke("Export", true, $"Exported to Downloads: {Path.GetFileName(destZipPath)}");
}
catch (Exception e)
{
// ... error handling ...
}
}
private void ScanFile(string filePath)
{
#if UNITY_ANDROID && !UNITY_EDITOR
try
{
using (AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
using (AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity"))
using (AndroidJavaObject context = currentActivity.Call<AndroidJavaObject>("getApplicationContext"))
using (AndroidJavaClass mediaScanner = new AndroidJavaClass("android.media.MediaScannerConnection"))
{
mediaScanner.CallStatic("scanFile", context, new string[] { filePath }, null, null);
}
Debug.Log($"[{Constants.LOG_TAG}] Triggered media scan for: {filePath}");
}
catch (Exception e)
{
Debug.LogWarning($"[{Constants.LOG_TAG}] Failed to trigger media scan: {e.Message}");
}
#endif
}✅ Acceptance Criteria
- ZIP files appear immediately in Quest Files app after export completes
- No restart required to see exported files
- Update success message to remove restart warning
🧪 Testing
- Export a recording using "Export Data" button
- Wait for "Export complete" message
- Open Quest Files app
- Navigate to Downloads folder
- ✅ Verify ZIP file is visible immediately
- No restart needed
📚 References
- Android MediaScannerConnection docs: https://developer.android.com/reference/android/media/MediaScannerConnection
- Similar issue discussion: https://stackoverflow.com/questions/13270789/how-to-run-media-scanner-in-android
🔗 Related Files
Assets/RealityLog/Scripts/Runtime/FileOperations/RecordingOperations.cs(lines 54-127, 277-320)README.md(line 57) - mentions this known issue
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed