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,094
Last edited:

mistermentality

Active Member
Licensed User
Longtime User
I'm sure this library would be brilliant for my needs if I could get it working, so apologies for what may be obvious but how are people getting this to share files by sms? On my 2.3.5 gingerbread phone it only offers "gmail and skype" and nothing else such as messaging or facebook even though if I use apps on my phone that share then the other options appear so I can't see why they won't by using the library.

I've tried using it to share a file that contains encrypted text, and also tried with standard flat text file, via text message but for some reason I get none of the other options mentioned here such as messaging or facebook. Is there something I need to add to the manifest?

My most recent try at doing this is:

share.sharebinary("file://" & File.DirRootExternal & "/temp.nck", "Text/txt", "some text", "some more text")

to send an encrypted text file which has the extension nck.

If I try sharing with gmail it shows the attachment but does not send it whether I use two or three / characters, and still does not offer other options such as messaging. Any ideas why?

I'm using version 1.92 of B4A and the share library linked to in the threads first post, could this be why?

Thanks for any ideas.

Dave

Edit: After re reading this thread lots of times I've just realised this is for images only by the sound of it. Sorry.
 
Last edited:

mkvidyashankar

Active Member
Licensed User
Longtime User
Hi

I tried to use this library but not able to share to facebook or gmail.

In case of gmail file is not attaching to mail
In case of Facebook i got the error message

"An error occured while saving the photo"

mY code is
B4X:
Sub Button_SHARE_Click
   io.writeBitmapToFile(imageview1.Bitmap,dirdefault,"temp.jpg",100)
   
   Dim share As MESShareLibrary
   share.sharebinary("file://" & File.DirDefaultExternal & "/Sketchysnaps/temp.jpg","image/jpg","Created By Sketchy Snaps","Do you See this?")
   
   
End Sub

Help please
 

luke2012

Well-Known Member
Licensed User
Longtime User
Facebook

Hi,
It's possible to show only the Facebook and twitter options in the share menu ?
 

Prosg

Active Member
Licensed User
Longtime User
Hello,

I need to share a picture and your librairie was a good idea.

I try it, it's simple but for me it's attached the file but people never received

Have you the final version of it ?
 

Renegao

New Member
Licensed User
Longtime User
Just tested your library...

Hi, I must say ...works fine !!!!
My phone is on Gingerbread and I have success on gmail and WhatssAPP using this...

share.sharebinary("file://" & File.DirRootExternal & "/" & Filename&Cnt&".png", "image/png", "Envio de imagen", "Has visto esto?")

Thanks for your

:sign0098:
 

holdemadvantage

Active Member
Licensed User
Longtime User
Hi all, thanks for this library.
Now i can share image but no text with whatsapp,facebook :signOops: :sign0163:

B4X:
Dim share As MESShareLibrary
   
   File.Copy(File.DirAssets, "screen1.jpg", File.DirDefaultExternal, "screen1.jpg")
share.sharebinary("file://" & File.DirDefaultExternal & "/screen1.jpg","image/jpg", "Share Poker Hand Matchups", "Download Poker Hand Matchups here http://tiny.cc/phmapk")

I'm able to share body txt and image but no subject with mail :sign0163:

I can share all by Twitter :sign0098:
 

Dave O

Well-Known Member
Licensed User
Longtime User
Just noticed that when I share to Gmail, it attaches the file OK, but the text I supplied goes into the body, not the subject line.

(I'm using file:/// as described above.)

Any way to fix this?
 

yttrium

Active Member
Licensed User
Longtime User
So this is basically a friendly wrapper for Intents?

Seems neat.

Just noticed that when I share to Gmail, it attaches the file OK, but the text I supplied goes into the body, not the subject line.

(I'm using file:/// as described above.)

Any way to fix this?

Isn't there a default email compilation method as part of the Phone library?
http://www.b4x.com/android/help/phone.html#email

Perhaps you should use that instead of the Share Library.
 
thanks a million.. finally get the thing i want working..

i desperately want to make the share button.. look everywhere.. and i bump to this thread..

nice job..
 

merlin2049er

Well-Known Member
Licensed User
Longtime User
Got to try this library out. I'd like to give an option to share a listview to fb. Would I need to create a file first, or just send the listview as a text string?
 
Last edited:

merlin2049er

Well-Known Member
Licensed User
Longtime User
ok, got the library installed. I see that you need to give it a file.

But what do you attach the share to? a button?
 

luke2012

Well-Known Member
Licensed User
Longtime User
Very good work!
No way to enable posting text to FB as library function ?
 
Last edited:

JordiCP

Expert
Licensed User
Longtime User
Hi all!

I am using this library and works perfect! Thank you

Does any one know if it is possible to change the font used for a custom one? Perhaps with reflection, I don't know. Also background color, etc.

I need to integrate it in my app and would be really great id I could use the same font.
 

Douglas Farias

Expert
Licensed User
Longtime User
good lib , unique problem is share at facebookm you can share only a image no text and no link :confused:
 

luke2012

Well-Known Member
Licensed User
Longtime User
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

Hi @ssg !
First of all : my compliments! Very good work ! :)

I'm testing your library to share an image on :

- Google+ : OK
- Hangout : OK
- Facebook : OK (but the text doesn't appear)
- WhatsApp : OK (but the text doesn't appear)

It's possible to share the text also with Facebook & WhatsApp ?

Thank you in advance.
 
Last edited:
Top