B4A Library Share Library - Beta!

Hi folks,

This has been raised many times on the forum, unfortunately the intent library in B4A seems to have problems placing images as attachment.

Please find attached a new share library.

This library has the option to show the share window, and I've tested it works with following:

Facebook
Twitter
Messaging
Picasa
WhatsApp
Email client

It does not work with the default GMail (Google Mail) app. I've searched online and it is an issue with GMail app itself I think (many people have raised similar issue). Will keep looking for a solution.

It also lessens down the share code for images to 2 lines :D

I need your help in testing this library!

Please feedback whether it works or not.

Sample code:

B4X:
Dim share As MESShareLibrary
share.sharebinary("file:/" & File.DirDefaultExternal & "/Image1.png", "image/png", "Do you see this?")

Enjoy!

-Bill
 

Attachments

  • MESShareLibrary.zip
    2.5 KB · Views: 2,103
Last edited:

vb1992

Well-Known Member
Licensed User
Longtime User
Nice work, have you tried to also pass text message along with the image?

That would be helpful in many ways.

Something like this

Dim share As MESShareLibrary

share.sharebinary("Visit basic4ppc.com today","file:/" & File.DirDefaultExternal & "/Image1.png", "image/png", "Do you see this?")
 

ssg

Well-Known Member
Licensed User
Longtime User
Hi vb1992,

Thanks for testing. Strange that it works with your Gmail. Did you try sending the mail out? On my device, in the compose screen it shows the attachment, but when I click send, the email does not attach the file.

Also good suggestion about the text part. Gimme some time to add that in!

Cheers!
 

vb1992

Well-Known Member
Licensed User
Longtime User
1) The Yahoo error is:

"Read access denied."

2) Gmail, yes it attached, but I should have hit send, I just did, and you are correct, no attachment made it to the receiving end.

3) I think the biggest thing is that you are able to connect to the Facebook App, regular intents were bringing me to a web browser to add the photo to facebook, while your library brings up the facebook app, that alone is awesome, since we live in a facebook sharing world
 
Last edited:

ssg

Well-Known Member
Licensed User
Longtime User
Ok, this is the CAPITAL of weirdness!

if you use "file:///bla bla bla" (with 3 slashes instead of 2), the file gets attached to the gmail and it can be sent out!!!

what a shocker!

Please try to test with 3 slashes on other apps and report in! It works for twitter and facebook too!! :D

Mucho Gracias!
 

ssg

Well-Known Member
Licensed User
Longtime User
Hi all,

Library in first post updated with 1 extra parameter for text.

Pass in empty string if you dont wanna use it.

The text auto fills in your email content or your twitter message (not working with facebook somehow)...

Give it a test!

Goodest luck!
 

ssg

Well-Known Member
Licensed User
Longtime User
For those who cant get the library to work.. here is how to call it:

B4X:
Dim share As MESShareLibrary
share.sharebinary("file://" & File.DirDefaultExternal & "/picture1.png", "image/png", "Share the love!", "This is the text to go in the body!")

Please let me know if you're having trouble launching the intents with this..

Cheers!
 

Dave O

Well-Known Member
Licensed User
Longtime User
Great stuff, just added a "Share" menu item to my first app with 2 lines of copied code.

Thanks!
 

ssg

Well-Known Member
Licensed User
Longtime User
I think lots of people are having issues with facebook's text sharing thing. There seems to be an issue with it.

Are you able to share text via the standard share feature in B4A?

It might be that Facebook and Google+ need some different type of texts set up to share.
 

Jack Cole

Well-Known Member
Licensed User
Longtime User
I've not yet tried just sharing text using the intent method on Facebook. It does seem to be a widespread issue. I did find one place that said adding this worked:

shareCaptionIntent.putExtra(Intent.EXTRA_TITLE, "my awesome caption in the EXTRA_TITLE field");

I don't know if that could be put into your library or not.
 

ssg

Well-Known Member
Licensed User
Longtime User
I tried adding that intent... seems to be launching the browser.

Attached a sample if you could give it a try (don't have a proper program to test with now), use the new title parameter.

Cheers!
 

Attachments

  • MESShareLibrary-D1.zip
    2.7 KB · Views: 788

Omar

Member
Licensed User
Longtime User
No Attachment

Hey ssg,

I tried the attachment option with both double and triple slashes but unfortunately there was no attachment with Gmail.

Although it shows the attachment as added to the message, it is not actually sent with the message which is strange.
 
Top