When trying to take screenshots and sharing with social networks by using Share-Extension(@fbricker ) I have these errors:
This happens when testing with neko output and it will be crashed on Android (I have not tested on iOS yet)
Share.defaultSubject = "myText";
I’m using the latest version of OpenFL/Lime and Share-Extension
Any help would be appreciated!
I can confirm that sharing bitmap doesn’t work on openfl-next, works fine on legacy.
@singmajesty using lime.system.System.documentsDirectory crashes android app (fatal signal), perhaps accessing documents directory is not implemented yet?
Easy way to reproduce crash:
class Main extends Sprite
public function new()
var btn:Sprite = new Sprite();
btn.graphics.drawRect(0, 0, 100, 100);
Hello!I have these lines on my project.xml
<source path="src" />
<set name="openfl-legacy" />
<haxelib name="openfl" />
It works if you just want to share with text or links but crashed when adding BitmapData
It seems we have to wait the next update of OpenFL to fix the bugs you mentioned above because we can not access the documents directory? @singmajesty
As far as I know
<set name="openfl-legacy" /> won’t work with newest openfl/lime. You could try downgrading both openfl and lime. I’m using lime 2.9.0, openfl 3.6.1 and hxcpp 3.2.205 (not sure if hxcpp needs to be downgraded as well) and sharing bitmapdata works fine. Keep in mind that dowgrading libs can produce errors in other parts of your code.
I have to update to the latest version of OpenFL/Lime because it can fix the text field bugs when scaling down. Thanks for your info!
Here’s a quick fix for openfl next:
In the extension-share/2,4,2/java/ShareEx/project/android/shareex/ShareEx.java add
public static String getDocumentsDirectory()
return android.os.Environment.getExternalStorageDirectory() + "/Documents/";
in extension-share\2,4,2\extension\share\Share.hx change
imagePath = lime.system.System.documentsDirectory + "/" + fName; to
var documentsDirectoryMethod:Dynamic = openfl.utils.JNI.createStaticMethod("shareex/ShareEx", "getDocumentsDirectory", "()Ljava/lang/String;");
imagePath = documentsDirectoryMethod() + "/" + fName;
imagePath = lime.system.System.documentsDirectory + "/" + fName;