[Godot] Can I directly access files saved on Android to user:// ?

  • Thread starter Thread starter Darkmisc
  • Start date Start date
  • Tags Tags
    Android godot
Click For Summary

Discussion Overview

The discussion revolves around accessing files saved in the user:// directory of a Godot application on Android devices. Participants explore the challenges of locating these files outside the app, particularly in the context of Android's sandboxing restrictions.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant expresses difficulty in locating files saved to user:// on their Android device, noting that the directory appears empty despite showing hidden files.
  • Another participant explains that Android apps operate within a sandbox, making files accessible only from within the app itself, and suggests that sharing intents may need to be enabled for file access.
  • A later reply confirms that files can be loaded and deleted within the app and accessed on a PC when running the app in Godot, but cannot be found directly on the phone's directory when connected to a PC.
  • Another participant agrees that the sandboxing is likely by design and suggests implementing a method to save files to a globally accessible location on the device.

Areas of Agreement / Disagreement

Participants generally agree on the sandboxing nature of Android applications and the limitations it imposes on file access. However, there is no consensus on the best method to access or share these files outside the app.

Contextual Notes

The discussion highlights the limitations imposed by Android's file system and the need for potential workarounds to access files saved by applications.

Who May Find This Useful

Developers working with Godot on Android, particularly those interested in file management and sharing within mobile applications.

Darkmisc
Messages
222
Reaction score
31
TL;DR
My program saves files to user://. I'd like to find these files on my phone and copy them to another phone. Is it possible?
Hi everyone

My program saves files to user://. I'd like to find these files on my phone and copy them to another phone. Is it possible?

I used
ProjectSettings.globalize_path("user://")

to show where the file saved and got

/data/org.godotengine.[APP_NAME]/files/

However, when I went to the directory, it was empty (I have show hidden files on). When I checked the properties of /files/, it showed 0 bytes and zero files.

I did a file search on my phone under the file name and nothing came up either.


Thanks
 
Technology news on Phys.org
Typically with iOS and Android, these folders that the app has access to are sandboxed and only available from within the app. I would be interested if you were able to save the file, and then from in the app, pull up and find the file saved at that location. I'm not very familiar with godotengine, but I know with similar things, you have to enable sharing intents. You can read more about sending and receiving files through intents here:

https://developer.android.com/training/sharing/send
https://developer.android.com/training/sharing/receive
 
  • Like
Likes   Reactions: Darkmisc
weller said:
Typically with iOS and Android, these folders that the app has access to are sandboxed and only available from within the app. I would be interested if you were able to save the file, and then from in the app, pull up and find the file saved at that location. I'm not very familiar with godotengine, but I know with similar things, you have to enable sharing intents. You can read more about sending and receiving files through intents here:

https://developer.android.com/training/sharing/send
https://developer.android.com/training/sharing/receive
The files shows up and can be loaded and deleted within the Android app. I can also find it on my PC and open it as a text file when I run the app within Godot.

What I can't do is plug my phone into the PC and find the file on my phone in a directory.
 
Yes, I think this is going to be by design since the apps are sandboxed. You'll need to implement something like what I mentioned above and save it off to another place that is globally accessible by the device.
 
  • Like
Likes   Reactions: Darkmisc

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 22 ·
Replies
22
Views
2K
Replies
10
Views
6K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
Replies
81
Views
7K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 11 ·
Replies
11
Views
2K