Skip to content
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

Implement file provider capabilities #72495

Merged
merged 1 commit into from
Feb 1, 2023

Conversation

m4gr3d
Copy link
Contributor

@m4gr3d m4gr3d commented Feb 1, 2023

The previously used file sharing api was restricted after Android N causing the engine to crash whenever used on devices running Android N or higher.

3.x version

The previously used file sharing api was restricted after Android N causing the engine to crash whenever used on devices running Android N or higher.
@akien-mga akien-mga merged commit 010a873 into godotengine:master Feb 1, 2023
@akien-mga
Copy link
Member

Thanks!

@m4gr3d m4gr3d deleted the implement_file_provider branch February 1, 2023 23:23
@m4gr3d
Copy link
Contributor Author

m4gr3d commented Feb 19, 2023

Any documentation about this?

@handre-dev This is the Android implementation behind the OS#shell_open api.

@Calinou
Copy link
Member

Calinou commented Feb 20, 2023

Maybe I misunderstood, but it seems to me that this is about file sharing on Android. I didn't know Godot had such an API built-in, in fact I made a plugin for it. Am I off track?

See godotengine/godot-proposals#6168.

@m4gr3d
Copy link
Contributor Author

m4gr3d commented Mar 5, 2023

@Derektamente The issue happens because the <provider> elements are merged using the android:name attribute, so the entry in your plugin's manifest collides with the entry in the Godot library's manifest.

The easy fix is to remove the entry in your plugin's manifest. Since the entry is already contained in the Godot library's manifest, your plugin will still be able to use the FileProvider's capabilities.
Don't forget to update the authority used in FileProvider#getUriForFile(...) to match the value in the Godot library's manifest (e.g: example).

@m4gr3d
Copy link
Contributor Author

m4gr3d commented Mar 5, 2023

@Derektamente It's because of the differences in the file provider paths configuration:

  • Your plugin's:
<paths>
    <files-path path="/" name="filesRoot" />
</paths>
  • Godot's configuration:
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">

	<external-path
		name="public"
		path="." />

	<external-files-path
		name="app"
		path="." />
</paths>

You can test by adding your configuration to Godot's; if that fixes the issue, feel free to send a PR to include it in the code base.

@lewiji
Copy link
Contributor

lewiji commented Mar 9, 2023

I've helped @Derektamente to get a build with these changes up and running, and they've verified that the change allows the Godroid plugin to work with the changes from this PR. Have created a PR with the change just now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants