I have a Codenameone ShareButton in my app, when pressed opens a dialog containing a list of the standard social media apps, that i have on my device, eg. Facebook, SMS, Email, Twitter.
I am trying to get a combination of text, image and URL into the ShareButton dialog for Facebook, but failing. It seems to work for the other types of media. I have scoured StackOverflow without luck on this one.
I can share an image to facebook successfully:
ShareButton sb = new ShareButton();
sb.setImageToShare(imageFile, "image/png");
I can share a URL to facebook successfully:
ShareButton sb = new ShareButton();
sb.setTextToShare("www.mywebsite.co.uk");
My goal is to share a piece of text, a URL and an image to facebook (which i can do to other media). My issues are:
Text wont display in the facebook app dialog:
ShareButton sb = new ShareButton();
sb.setTextToShare("The text i want to display");
I have seen conflicting posts over the years about FB support for this, so maybe i'm doomed on this one.
I tried to trick it and prefix or suffix text to the URL but this didn't display that text still.
So I want to display an image and a URL in the post to FB and it really is just one or the other it seems. So the code below will display just the URL on its own in the FB dialog without the image (swapping out the URL for regular text, displays the image and no text):
ShareButton sb = new ShareButton();
sb.setImageToShare(imageFile, "image/png");
sb.setTextToShare("www.mywebsite.co.uk");
I'd be happy with just option 2 if needs be.
To be clear i'm using the facebook app on my device to share and not a token connection direct to facebook.
And if it helps i do have my own website, if there was a way to send it content and it dynamically build up the content for display, but that may not be possible (i'm no web developer).
As far as I recall from the last time I was dealing with posting to facebook, they don't allow you to post both an image and text, or a URL and text together. If you want to have something show up in the user's feed that includes both an image and a description, you'll need to create a web page that includes Facebook's supported Open Graph markup, which will cause it to be displayed "nicely" in the user's feed.
In projects I have worked on in the past, they used dynamic webpages so that it was easy to create a webpage that was specific to the content you want to post in the user's feed. You can essentially generate a separate webpage for each "share" if necessary.
We used the feed API directly. I'm not sure if it works from the share button, but if you were able to post a URL, then it probably works.
Related
What I am trying to do from my Codenameone app, in Eclipse, is to send a piece of Text and an Image to my Facebook wall. Simple (or is it). Can anyone explain to me how to achieve this in Java (in a CN1 app) please?
I am not wanting the user to login to facebook in my app. Instead, to achieve this in the same way that many mainstream apps do this (eg. BBC News app) where they use the Facebook app, that is already installed on the device, in the list of destinations to Share to, which resolves the FaceBook connection issue. If the user doesn't have FB app installed then I will not make this available to them.
I have read articles online but they are a number of years old (post out of date) or make use of tokens (for which I have little knowledge how to implement).
Assuming the above is possible then any information on formatting the destination post would be a real plus.
Many thanks in advance.
Answered by #WizKid, #Diamond, #Shai Almog.
I have put a ShareButton component on my screen allowing the user share with FB, Twitter etc.
ShareButton sb = new ShareButton();
sb.setUIID("Label");
sb.getAllStyles().setAlignment(Component.TOP);
String imageFile = FileSystemStorage.getInstance().getAppHomePath() + getMyFileName();
sb.setImageToShare(imageFile, "image/png");
sb.setTextToShare("My Text to share");
This works nicely, although its doesn't put the text from my setTextToShare() into FB but does Twitter and Email. Strange. Photo goes up and it does allow me to type my own text in.
http://gates.cc/works/thisisyours/site/p/fairytale-fashion-collection-61 this is my website url. Here you can see the facebook share using addthis on right side. Please help me what problem in this page. In facebook share box have link only not showing the title, description and the images.
Method 1 :
Facebook treats each url as unique and caches the page based on that url, so if you want to share the latest url the simplest solution is to add a query string with the url being shared. In simple words just add ?v=1 at the end of the url. Any number can be used in place of 1.
Method 2:
Facebook has a tool called Debugger (formerly known as URL Linter). This tool gives us an idea about how a url will be shared on Facebook, what content, which image will be fetched.
I hope this helps
I am trying to make a windows phone app using cocos2d-x WP8 port.
I wanted to post the final score of the player on Facebook if he presses the Facebook share button in the app.
So I tried the method explained here:
Post to facebook status with a URL / GET request? (or post)
The link for twitter is working fine, but for facebook, the text that I want to share does not appear in the text area of post. Any help will be appreciated, thanks.
The Facebook sharer to this date is a resurrected version of the sharer from 2011. The only possible parameter to set is the u parameter. Fix the metadata of the URL being referenced to modify title data (i.e. you must own the URL to modify for use with sharer.php, otherwise you will be forced to use the title the owner of the URL used).
I need to create a "contest" page where user will be asked to submit picture.
After that, they should be able to share their picture on FB, Twitter, G+, Pinterest, etc for other people to come and vote.
I want the page to be displayed as a jQuery gallery and whenever people select a thumbnail, the bigger picture open with the associated vote and "share" button.
When a user share an image, I want a specific TITLE & URL associated with that particular image... something like "http://www.mysite.com/contest.html#picture1"... or "http://www.mysite.com/contest.html#picture2"
How is this possible if I only have one page?
I wouldn't have problem if I could use the old "facebook.com/sharer.php" with parameters... but it seems that the Open Graph Protocol is "overiding" the sharer.php parameters....
Works fine with Twitter and Pinterest... I might have the same problem with Google+.
Excuse my bad english, thanks!
Well, set up a (“dummy”) page for each picture, and fill it with the appropriate OG tags … and have your users like that. And then put a JS redirect into that page, so that users following the link when it’s shared on Facebook will get to the “real” address you want them to end up at.
(Btw., IMHO this is what happens too often these days when people think doing everything client-side and client-side only is so “fancy” and that a “good” and “modern” site requires all that AJAX/one-page-only nonsense instead of a real good and working URL structure, and then are not able to handle all that this implies properly …)
I am currently working on a rebranding with my company, and I am having some issues with the thumbnails which are appearing next to the facebook posts when someone shares our website. The issue is that our old logo is still appearing in the thumbnail image, and not our new one - not ideal. Is there an easy way of updating the choice of these thumbnails to give the choice of our new logo?
Make sure you have the correct OpenGraph og:tags in your HTML markup and use the Facebook Debugger to scrape your URL and refresh Facebook's caching of your URL; it will show you what metadata Facebook can see for your URL.