I don't think it is possible without a plugin. But writing plugins in Gideros is easy though no need to afraid. There are so much good tutorials and examples on this subject in the forum. Just search and you will find.
@totebo it is easy if you are using Gbridge http://giderosmobile.com/labs/native-ui simply create a method in GBridge.java class with basically same contents as in your link And call it in lua
I can't share the plugin because i modified another plugin for this. It won't me no much work if you just modify another plugin, for example Ads Interface plugin. In this case, i modified loadAd. (sActivity is private WeakReference which i got from Ads Interface plugin)
Hey @larf, I took a screenshot and shared it with the native Android share in No Brakes. It worked pretty well, although for unknown reason images were saved as heavily compressed jpegs, even though I specified PNG in the GBridge method in Java. After Lollipop was released, however, I got a flood of crash reports coming in from Crashlytics, so I went for the safe option and removed the screenshot capability on Android. I'm guessing this was down to my Java coding skills (inexistent).
Hi @totebo. thanks for the reply! Looks like we're in a similar boat (non existant java skills). I've managed to create a function in Gbridge and activate the android share intent. I haven't tried to send images captured by media plugin yet, but my test images showed up without any trouble. I'm testing on a nexus 7 running android L.
local image_path = native.getPath("|R|images/share.png") local bridge = native.getClass("com.giderosmobile.android.plugins.bridge.GBridge")--bridge.ShareImage("file://" .. image_path)
This works for twitter, gmail, etc, just a few problems.
problem 1: Every time I try to share anything to Facebook via the android intent it I get "Please attach only photos or a single video."
After some searching it seems like facebook doesn't accept posts from android share intent with with pre-filled text. I can't even get it to work if I try to just share an image. Did you have any luck with this?
Only i'm not doing anything with sound, just calling native.getClass("com.giderosmobile.android.plugins.bridge.GBridge") seems to cause it. Interestingly, it only happens when I'm in debugging mode in ecliplse. If i sign and export the project it doesn't happen.
If I get things working a bit better i'll post an update
Comments
http://giderosmobile.com/labs/native-ui
simply create a method in GBridge.java class with basically same contents as in your link
And call it in lua
here is more discussion on it:
http://giderosmobile.com/forum/discussion/comment/34701#Comment_34701
I'd love to use native share in android if it's not too much work.
and then on values/String.xml add:
It won't me no much work if you just modify another plugin, for example Ads Interface plugin. In this case, i modified loadAd.
(sActivity is private WeakReference which i got from Ads Interface plugin)
I'm pretty much a noob at native android programming.
I think I might try adding a function to Gbridge like @ar2rsawseen suggested,
it seems like that might be easier.
If I can't get it to work i'll try making my own plugin.
What I really want to do is take a screen shot with media plugin and share it with some text. Seems like it should be possible with Gbridge.
If you do get it to work, please share!
Niclas
For anyone interested here's my Gbridge function
public static void ShareImage(String image_path)
{
Uri uriToImage = Uri.parse(image_path);
Intent shareIntent = new Intent();
shareIntent.putExtra(Intent.EXTRA_TEXT, "example text");
shareIntent.putExtra(Intent.EXTRA_TITLE, "example title");
shareIntent.putExtra(Intent.EXTRA_SUBJECT, "example subject");
shareIntent.putExtra(Intent.EXTRA_STREAM, uriToImage);
shareIntent.setType("image/*");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
sActivity.get().startActivity(Intent.createChooser(shareIntent, "Share score using"));
}
needed to import these at the top of Gbridge
import android.content.Context;
import android.content.Intent;
Here's what I call in my project
local image_path = native.getPath("|R|images/share.png")
local bridge = native.getClass("com.giderosmobile.android.plugins.bridge.GBridge")--bridge.ShareImage("file://" .. image_path)
This works for twitter, gmail, etc, just a few problems.
problem 1:
Every time I try to share anything to Facebook via the android intent it I get
"Please attach only photos or a single video."
After some searching it seems like facebook doesn't accept posts from android share intent with with pre-filled text.
I can't even get it to work if I try to just share an image.
Did you have any luck with this?
I spent a day trying to integrate this into my project with limited success
https://github.com/b099l3/FacebookImageShareIntent
However, every time it to post successfully my app crashes
problem 2:
I'm having a similar issue to what you're experiencing here:
http://giderosmobile.com/forum/discussion/5392/android-l-lollipop-doesnt-like-gideros/p1
JNI DETECTED ERROR IN APPLICATION: illegal class name 'com.giderosmobile.android.plugins.bridge.GBridge'
Only i'm not doing anything with sound, just calling
native.getClass("com.giderosmobile.android.plugins.bridge.GBridge")
seems to cause it.
Interestingly, it only happens when I'm in debugging mode in ecliplse.
If i sign and export the project it doesn't happen.
If I get things working a bit better i'll post an update
If anyone is interested in trying to use it I can maybe help them get it to work.