Giter Site home page Giter Site logo

godot-android-share-plugin's Introduction

Donate

GodotShare

This is an Android share plugin for Godot Game Engine 3.2.2 or higher. With that you'll be able to share text and/or images in your apps.

* For Godot < 3.2 or iOS support you can use the old module.

Image Sharing Screenshot

How to use

  • Configure, install and enable the "Android Custom Template" for your project, just follow the official documentation;
  • go to the releases tab, choose a version and download the respective GodotSharePlugin-x.x.x.zip package;
  • extract the zip content (GodotShare.release.aar and GodotShare.gad files) inside the res://android/plugins directory on your Godot project;
  • on the Project -> Export -> Options, turn on the "Use Custom Build" and "Godot Share" on the "Plugins" field;

Export options

ATTENTION: An important note is that the image you want to share must be saved on the "user://" virtual directory root to be accessible, you can use OS.get_user_data_dir() to get its absolute path (required by sharePic). In the demo directory you'll find a working sample project where a screen capture is shared.

Donations

Was this project useful for you? Wanna make a donation? These are the options:

Paypal

My Paypal donation link

Brave browser

Even without spending any money you can still help me installing Brave browser using my referral link. If you do so and keep using the browser, I'll receive some reward.

If you're already a Brave user, please consider donating some BATs ;)

API Reference

The following methods are available:

# Share text
# @param String title
# @param String subject
# @param String text
shareText(title, subject, text)

# Share image
# @param String image_abs_path The image location absolute path
# @param String title
# @param String subject
# @param String text
void sharePic(image_abs_path, title, subject, text)

godot-android-share-plugin's People

Contributors

cengiz-pz avatar code-with-max avatar maniche04 avatar shin-nil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

godot-android-share-plugin's Issues

Broken in 3.2.4rc5

Hello Shin-Nil
Thank you for this plugin it worked perfectly up until 3.2.3

In the current 3.2.4rc5 it crashes the game:

I get the following verifying issue:

Process: org.godotengine.godotshareplugindemo, PID: 4359
java.lang.VerifyError: Verifier rejected class shinnil.godot.plugin.android.godotshare.GodotShare: void shinnil.godot.plugin.android.godotshare.GodotShare.(org.godotengine.godot.Godot) failed to verify: void shinnil.godot.plugin.android.godotshare.GodotShare.(org.godotengine.godot.Godot): [0x3] register v1 has type Reference: org.godotengine.godot.Godot but expected Reference: android.app.Activity (declaration of 'shinnil.godot.plugin.android.godotshare.GodotShare' appears in /data/app/org.godotengine.godotshareplugindemo-XnxD3cM0rN41nFCNJgobjg==/base.apk)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at java.lang.Class.forName(Class.java:379)
at org.godotengine.godot.plugin.GodotPluginRegistry.loadPlugins(GodotPluginRegistry.java:141)
at org.godotengine.godot.plugin.GodotPluginRegistry.(GodotPluginRegistry.java:63)
at org.godotengine.godot.plugin.GodotPluginRegistry.initializePluginRegistry(GodotPluginRegistry.java:95)
at org.godotengine.godot.Godot.onCreate(Godot.java:585)
at androidx.fragment.app.Fragment.performCreate(Fragment.java:2414)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1418)
at androidx.fragment.app.FragmentTransition.addToFirstInLastOut(FragmentTransition.java:1195)
at androidx.fragment.app.FragmentTransition.calculateFragments(FragmentTransition.java:1078)
at androidx.fragment.app.FragmentTransition.startTransitions(FragmentTransition.java:117)
at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2408)
at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)
at androidx.fragment.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:2243)
at androidx.fragment.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:654)
at org.godotengine.godot.FullScreenGodotApp.onCreate(FullScreenGodotApp.java:61)
at com.godot.game.GodotApp.onCreate(GodotApp.java:46)
at android.app.Activity.performCreate(Activity.java:7802)
at android.app.Activity.performCreate(Activity.java:7791)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3251)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2022)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:359)
at android.app.ActivityThread.main(ActivityThread.java:7418)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)

Do you have any idea how to solve this?

Problem using plugin

I do not understand how to add a plugin. I don’t understand how to use the archive you need to download. In my project, in the android directory, there is no share-plugin directory.

Demo don't work in android 5.1

Godot 3.2 stable + Debian 10
Hi I tried the demo in my device but it don't start.
No error messages. Just do nothing. I tried to open the demo from my device with no result.

ps.: I have another android app that work properly but when I add the "android" folder in project it stop working too.
Thank you

FileProvider change

The FileProvider should be changed to:

androidx.core.content.FileProvider

What must I autoload?

I have the files in the plugins directory but in the demo you wrote "
if Engine.has_singleton("GodotShare"):
share = Engine.get_singleton("GodotShare")
". But what can I autoload, there is no script. What am I missing or overlooking?

How do check if the plugin was loaded?

Usually in Godot modules I use to check if the module is loaded using something like:
if (Engine.has_singleton("GodotShare"))

Any way of checking it for this plugib?

Problem from Godot 3.6

Hi...
I'm having these problems when trying to export. it seems to me that there is a conflict between these two attributes. it's probably very simple to work around this... I even managed to open the .aar file and find these attributes inside the AndroidManifest.xml file. But I don't really know what I should do...

Attribute provider#androidx.core.content.FileProvider from [godot-lib.debug.aar] AndroidManifest.xml:28:13-64
is also present at [GodotShare.release.aar] AndroidManifest.xml:18:13-51
Suggestion: add 'tools:replace="android:authorities"' to element at AndroidManifest.xml:26:9-34:20

Attribute meta-data#android.support.FILE_PROVIDER_PATHS@resource value=(@xml/godot_provider_paths) from [godot-lib.debug.aar] AndroidManifest.xml:33:17-61
is also present at [GodotShare.release.aar] AndroidManifest.xml:23:17-60 value=(@xml/file_provider_paths).
Suggestion: add 'tools:replace="android:resource"' to <meta-data> element at AndroidManifest.xml to override.

Rendering bug on newer phones after share window is closed.

I have been testing the plugin and I found a rendering bug on newer phones after the share window is closed instead of confirming the share.

It seems to be a rendering bug: close to top of window there is a small range about the size of a typical banner ad which the godot engine isn't clearing the screen, so you can see the trail of the objects and a white background.
After experimenting I have discovered it seems to be related to the stretch setting at: Project Settings > Display > Window

In my project, the bug will happen depending on the Aspect setting:

Mode: 2d

Bugged:
Aspect: keep_width
Aspect: expand

Not bugged:
Aspect: keep
Aspect: ignore
Aspect: keep_height

I am hoping to use this plugin in my android game so I can try to elaborate more about the bug if needed.
Thanks!

gradle.properties

shin-nil, please tell people to add those lines to gradle.properties file if they have an error:
android.useAndroidX=true
android.enableJetifier=true

Godot 3.2.1

Was this release left behind? I have tried but i get this:

image

Which one shall i use for the 3.2.1 stable? Do i have to switch to 3.2.2?

FileProvider issue on Godot 3.5.3

Hi dears.

I found an issue when building to Android using latest Godot version (3.5.3):

> Task :processDebugMainManifest FAILED
/home/me/Development/drum_tube/android/build/src/debug/AndroidManifest.xml:28:13-64 Error:
	Attribute provider#androidx.core.content.FileProvider@authorities value=(studio.melen.drumtube.fileprovider) from [godot-lib.debug.aar] AndroidManifest.xml:28:13-64
	is also present at [GodotShare.release.aar] AndroidManifest.xml:18:13-51 value=(studio.melen.drumtube).
	Suggestion: add 'tools:replace="android:authorities"' to <provider> element at AndroidManifest.xml:26:9-34:20 to override.
/home/me/Development/drum_tube/android/build/src/debug/AndroidManifest.xml:33:17-61 Error:
	Attribute meta-data#android.support.FILE_PROVIDER_PATHS@resource value=(@xml/godot_provider_paths) from [godot-lib.debug.aar] AndroidManifest.xml:33:17-61
	is also present at [GodotShare.release.aar] AndroidManifest.xml:23:17-60 value=(@xml/file_provider_paths).
	Suggestion: add 'tools:replace="android:resource"' to <meta-data> element at AndroidManifest.xml to override.

Could you please kindle help me to solve this issue?

Thanks a lot.

Error when GodotGetImagePlugin-Android is also enabled

This is an interesting one. Sharing was working fine until it stopped suddenly with the following error output:

05-18 15:18:17.911  6314  6394 D godot   : sharePic called
05-18 15:18:17.914  6314  6394 E godot   : The selected file can't be shared: /data/user/0/com.example.app/files/tempshot.png
05-18 15:18:17.915  6314  6394 E godot   : SharePic error: java.lang.IllegalArgumentException: Failed to find configured root that contains /data/user/0/com.example.app/files/tempshot.png

Eventually I got it to work again AFTER I disabled another plugin I had recently added:
https://github.com/Lamelynx/GodotGetImagePlugin-Android

So, when both plugins are enabled sharing doesn't work, but when the GetImage plugin is disabled sharing works.
This can be reproduced within the demo of this share plugin

There must be something causing an incompatibility when both are enabled that prevents the Share plugin from being able to open/find the image to share.

Any idea what can be changed to avoid the incompatibility?
@Shin-NiL

Share data files?

Hi, is it possible to share data files with this? I am working on a painting program and want to share the project files, (similar to a photoshop .psd document file) If not yet possible, where in the plugin source should I look to try to implement this myself?

Incompatibility with gradle-6.1.1-all.zip

Hello,

Found an incompatibility with gradle-6.1.1-all.zip.

Had to change the following:

GodotShare.java:

//import android.support.v4.content.FileProvider;
import androidx.core.content.FileProvider;

AndroidManifest.conf:

android:name="androidx.core.content.FileProvider"

Thanks.

  • Cristiano

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.