-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Android scoped storage requirements #38913
Comments
Did some digging around, could it have something to do with this? |
@HEAVYPOLY you're most likely running into scoped storage issues. The reason you're seeing that is because As mentioned in the scoped storage, you can temporarily restore the previous behavior by using the |
@HEAVYPOLY I didn't realize you were using an internal Godot method to save the file. @akien-mga Now that I have a fuller understanding of the issue, it's quite tricky as we possibly have a wide surface area to investigate/fix (pretty much any logic that write to file) and we only have until August 3, 2020 since API level A first approach would be to include the |
Sounds good, thank you. Is there a better way I should be handling all this? Is there a way to access native android share popup? |
@HEAVYPOLY It's hard to say given I'm not familiar with the logic from your app. Using Otherwise, the alternative is to wait until we clean those APIs. |
Ok, I will wait for the legacy external storage fix. Thank you! |
I think we should do this for now, especially as it will be needed for older stable branches like We should still work to implement the new scoped storage access ASAP, but this should be a good stopgap measure for 3.2.3 and 2.1.7 (and 3.1.3 if I make one). |
@akien-mga this has already been done by #39103. The issue remains open to track the full implementation for scoped storage. |
Thanks, I cherry-picked the change for 2.1.7: 11fba31. |
@HEAVYPOLY What's the api you were using to save the images and how are you generating the path where they are being saved? |
I get the user pictures path with OS.get_system_dir(). if SM.user_prefs.has("file_path"):
var dir = Directory.new()
dir.open(SM.user_prefs.file_path)
if dir.get_current_dir() == "res://":
print("RESETTING SAVE PATH")
SM.user_prefs.file_path = OS.get_system_dir(OS.SYSTEM_DIR_PICTURES) The images ideally should stay on device after uninstall, and using this method they do (since they are in pictures directory). side note: on iOS we don't have access to pictures directory so everything is saved to user folder and gets deleted on uninstall here is my save script, it uses standard save_png() func save_layer_png(layer, path, merge = false):
var ld = GB.get_layer_data_by_name(layer.name)
if merge == false:
if GB.get_layer_data_by_name(layer.name).visible == false:
print("SKIPPING SAVE LAYER PNG, INVISIBLE")
yield(get_tree(),"idle_frame")
return
layer.Export.rect_size = SM.canvas.size
layer.V.size = SM.canvas.size
layer.Export.modulate = layer.modulate
layer.Export.material = layer.material
layer.V.render_target_update_mode = Viewport.UPDATE_ONCE
yield(get_tree(),"idle_frame")
yield(get_tree(),"idle_frame")
var img:Image = layer.V.get_texture().get_data()
GB.Status.text = str("RENDERING LAYER ", layer.name.to_upper())
# print("APPENDING ", img)
# layerpngs.append(img)
if SM.user_prefs.batch_export_layers:
var img_path = path + "/" + str(SM.canvas.layers.find(ld)+1) + " " + ld.name + ".png"
img.save_png(img_path)
print("SAVING PNG BATCH ", img_path)
# img.save_png(path + "/" + str(layer.get_position_in_parent()+1) + " " + layer.name + ".png")
layer.V.render_target_update_mode = Viewport.UPDATE_DISABLED |
Godot version:
3.2.2 Beta 2
OS/device including version:
Android
Issue description:
Try to save image, get error "No permission grants found for com.google.android.apps.photos"
Read/Write external storage permssions are enabled in Android Export options. The same code worked in 3.2.1 stable.
Steps to reproduce:
Minimal reproduction project:
Logcat:
05-20 21:35:58.903 29344 29554 I godot : Loaded Strokes Drawn
05-20 21:35:57.777 1423 4285 W UriGrantsManagerService: No permission grants found for com.google.android.apps.photos
05-20 21:35:59.052 1423 4285 D ConnectivityService: filterNetworkStateForUid() uid: 10209, pid: 18529
05-20 21:35:59.052 1423 4285 D ConnectivityService: filterNetworkStateForUid() uid: 10209, pid: 18529, networkInfo: [type: WIFI[], state: DISCONNECTED/BLOCKED, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false]
05-20 21:35:59.052 1423 4285 D ConnectivityService: filterNetworkStateForUid() uid: 10209, pid: 18529
05-20 21:35:59.053 1423 4285 D ConnectivityService: filterNetworkStateForUid() uid: 10209, pid: 18529, networkInfo: [type: WIFI[], state: DISCONNECTED/BLOCKED, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false]
05-20 21:35:59.137 1423 4285 W UriGrantsManagerService: No permission grants found for com.google.android.apps.photos
05-20 21:35:59.137 1423 4937 W UriGrantsManagerService: No permission grants found for com.google.android.apps.photos
05-20 21:35:59.195 29344 29554 E godot : ERROR: Can't save PNG at path: '/storage/emulated/0/Pictures/HEAVYPAINT_EXPORT/asd.png'.
05-20 21:35:59.195 29344 29554 E godot : At: drivers/png/resource_saver_png.cpp:58:save_image() - Condition "err" is true. Returned: err
The text was updated successfully, but these errors were encountered: