Share Plugin allows sharing of text and images on Android platform.
For iOS version, visit https://github.com/cengiz-pz/godot-ios-share-plugin .
Follow instructions on the following page to create a custom Android gradle build
There are 2 ways to install the Share plugin into your project:
- Through the Godot Editor's AssetLib
- Manually by downloading archives from Github
Steps:
- search for and select the
Shareplugin in Godot Editor - click
Downloadbutton - on the installation dialog...
- keep
Change Install Foldersetting pointing to your project's root directory - keep
Ignore asset rootcheckbox checked - click
Installbutton
- keep
- enable the plugin via the
Pluginstab ofProject->Project Settings...menu, in the Godot Editor - remove/replace the
$gennametoken from thepackage/unique_namefield of your project's Android export settings.
Steps:
- download release archive from Github
- unzip the release archive
- copy to your Godot project's root directory
- enable the plugin via the
Pluginstab ofProject->Project Settings...menu, in the Godot Editor - remove/replace the
$gennametoken from thepackage/unique_namefield of your project's Android export settings
Add a Share node to your scene and follow the following steps:
- use one of the following methods of the
Sharenode to share text or images: -share_text(title, subject, content)-share_image(full_path_for_saved_image_file, title, subject, content)- Note that the image you want to share must be saved under theuser://virtual directory in order to be accessible. TheOS.get_user_data_dir()method can be used to get the absolute path for theuser://directory. See the implementation ofshare_viewport()method for sample code. -share_viewport(viewport, title, subject, content)
adb logcat is one of the best tools for troubleshooting unexpected behavior
- use
$> adb logcat | grep 'godot'on Linuxadb logcat *:Wto see warnings and errorsadb logcat *:Eto see only errorsadb logcat | grep 'godot|somethingElse'to filter using more than one string at the same time
- use
#> adb.exe logcat | select-string "godot"on powershell (Windows)
Using the default setting of com.example.$genname for package name (package/unique_name) in your Godot project's Android Export settings will not work with this plugin as the $genname token is not replaced before an Android export. Removing the $genname token from the package/unique_name is necessary for this plugin to work.
Also check out: https://docs.godotengine.org/en/stable/tutorials/platform/android/android_plugin.html#troubleshooting
Based on Shin-NiL's Godot Share plugin
Developed by Cengiz
Original repository: Godot Android Share Plugin
