I have an android game that allows the user to post to their facebook wall if they are having trouble on a level. I have the functionality of the facebook posting process working if i link an image from a hosting website instead of uploading it from my app. The reason I am doing this is to save time on loading the facebook post and i could not get the image uploader to work correctly.
I have over 900 levels with each level containing 1 image. I have written the following code for when the user clicks on the facebook button.
Bundle params = new Bundle();
params.putString("link", getResources().getString(R.string.msg_facebook_link));
params.putString("name", getResources().getString(R.string.msg_facebook_achievement_title_1)+" "+getLevel()+" "+getResources().getString(R.string.msg_facebook_achievement_title_2));
params.putString("caption", getResources().getString(R.string.msg_facebook_caption));
params.putString("description", getResources().getString(R.string.msg_facebook_achievement_text_1)+" "+getLevel()+getResources().getString(R.string.msg_facebook_achievement_text_2));
params.putString("picture", "http://i26.photobucket.com/albums/c106/" + getLevel() + ".png");
Although, i cannot find an image hosting site that gives the link address of the image uploaded. They all create custom addresses for every image. For example i am looking for address like this:
http: //i26.photobucket.com/albums/c106/1.png
http: //i26.photobucket.com/albums/c106/2.png
http: //i26.photobucket.com/albums/c106/3.png
but i am given address like this:
http: //i26.photobucket.com/albums/c106/fweh78932bfa.png
http: //i26.photobucket.com/albums/c106/83ja893ha99f.png
http: //i26.photobucket.com/albums/c106/fj9321la01km.png
which obviously will not work with my code. Are there any free sites that will make this work? I don't want to write a switch and case method for 900 custom addresses. If not, is their any other way to make this work without writing 900 indiviual level codes?
Related
I have an application with dynamic links implemented. I'm making request to get short link with all socialMetaTagInfo defined (socialTitle, socialDescription, socialImageLink)
link is so far only dummy page with simple and whole request looks like this (I'm not filling more fields):
{
"dynamicLinkInfo": {
"dynamicLinkDomain": "dl_domain",
"link": "http://www.my_page.com",
"androidInfo": {
"androidPackageName": string
},
"socialMetaTagInfo": {
"socialTitle": string,
"socialDescription": string,
"socialImageLink": string
}
}
}
When I share result short link on Facebook I can see nice post with image, title and description. However when I share the link via Google + only link is visible without social fields. (Same for Slack for example).
Do I have to create my fallback page first? Or am I doing something wrong? I just want to know how to display the image, title and description in other social apps (pages).
Title,Desc,Images are the additional meta tags which is added to your Dynamic links.
Apps like Facebook, Twitter, Google+ will be identifying the meta data from your url and load it in the UI.
It may fail to load if the Image size is large or if Google+ app is not coded to handle it.
I have an application that show to the user articles from news feeds.
I want to add Facebook like mechanism, that when the user push the like button,
his Facebook account will show that he is like this article.
So, I downloaded the Facebook sdk, and worked with the open graph example.
The problem is that I can't find any good example of how to to this.
I understand that I have action types, and object types. I added action type of me/og.likes and now I need to send the url of the selected article.
What I do so far is:
I have this lines, what they do is only add which type of action my application can handle.
this is working fine.
Bundle params = new Bundle();
params.putString("object", "http://samples.ogp.me/226075010839791");
Request request = new Request(
Session.getActiveSession(),
"me/og.likes",
params,
HttpMethod.POST
);
Response response = request.executeAndWait();
// handle the response
Now I want to send the actual url of the selected article, do I need to use some kind of outside url of an object or I can build object in my application and send it?
Any help would be great,
thanks.
When creating an action you must be sure that facebook robot can see the URL and correct meta tags. You can debug your page on this page. So in your case as I understand facebook can't visit your application and therefore can't determine meta tags in your app. So the solution I can offer is creating a web page which will generate meta tags depending on the $_GET[] parameter. You can pass an article ID and generate meta tags for that ID.
There is library which completely solve this issue (project page):
dependencies {
compile 'com.shamanland:facebook-like-button:0.1.8'
}
The simplest way to add like button:
<com.shamanland.facebook.likebutton.FacebookLikeButton
style="#style/Widget.FacebookLikeButton"
app:pageUrl="http://url.to.like/page.html"
app:pageTitle="Title of page"
app:pageText="Short description of page"
app:pagePictureUrl="http://url.to.like/picture.jpg"
/>
This view will be drawn in your layout:
After clicking on it you will see the dialog with official Facebook 'Like' plugin.
Read more details.
I want to know how to upload multiple photos at a time thru google plus?
I found how to upload one photo and one message at a time from google plus sample code.
String action = "/?view=true";
Uri callToActionUrl = Uri.parse(getString(R.string.plus_example_deep_link_url) + action);
String callToActionDeepLinkId = getString(R.string.plus_example_deep_link_id) + action;
// Create an interactive post builder.
builder = new PlusShare.Builder(this, plusClient);
// Set call-to-action metadata.
builder.addCallToAction(LABEL_VIEW_ITEM, callToActionUrl, callToActionDeepLinkId);
// Set the target url (for desktop use).
builder.setContentUrl(Uri.parse(getString(R.string.plus_example_deep_link_url)));
// Set the target deep-link ID (for mobile use).
builder.setContentDeepLinkId(getString(R.string.plus_example_deep_link_id),
null, null, null);
// Set the message.
builder.setText("user message");
// Set the image
Uri uri = Uri.fromFile(new File("[user file path]"));
builder.setStream(uri);
Anyone knows about uploading multiple photos like facebook and twitter?
It should work with addStream() method, unfortunately... it doesn't work. Indeed it makes the application crash.
After a long search, I finally got it: it's not possible if using the simplified G+ SDK! (the one dedicated to Android).
There is a second one, included in the Google API family that you can find there:
http://code.google.com/p/google-api-java-client/wiki/APIs#Google+_API
This one will let you build more advanced post, included, several pic one.
Unfortunately the second SDK is much more low level, not dedicated to Android, it's a kind of Java abstraction over http request.
Regards
I want to post a pre-defined message on Facebook through my android application. I got everything to work except the 'properties' field. I want to post a message where it says:
More information: here
and when the user clicks on 'here', it should link to the page.
This is what I did:
Bundle params = new Bundle();
String s2 = "{'More information':{'text':'here', 'href':" + details + "}}";
params.putString("properties", s2);
where 'details' is the link to the page.
But it seems like facebook is not picking up this line. I successfully set up the caption, picture and other fields.
Any insights? Thanks!
This is by design, as far as I know, we do not support HTML in status updates. We will automatically create a link if you post a valid URL however, so I would suggest just pasting out the full link
".....More information: (www.yourURLhere.com)"
On Facebook, www.yourURLhere.com will be a clickable link.
This code WAS working fine, but suddenly stopped showing the map thumbnail from either Bing or Google static maps.. Any ideas? Did Facebook change their own parsing of the picture urls?
Bundle parameters = new Bundle();
parameters.putString("message", et_message.getText().toString());
parameters.putString("description", "Currently Near");
parameters.putString("picture","http://maps.google.com/maps/api/staticmap?center=36.837812,-76.022045&zoom=15&size=110x110&sensor=false&maptype=hybrid&markers=color:blue|36.837812,-76.022045");
parameters.putString("caption", lStreet + " - " + lCity +", "+ lState + " : "+ lPhone);
parameters.putString("name", lName);
if(lUrl != null){parameters.putString("link", lUrl);}
mAsyncRunner.request("me/feed", parameters,"POST", new myPostListener(), 1);
Now the Wall Post on my Facebook seems to be changing the link to combine parts of the LINK url, along with the image URL. I don't have a clear example of this that I can post, but a rough example is:
link = http://foo.bar/
picture = http://somemaps/image1.jpg
Result when hovering over the broken image on Facebook is something like:
http://apk.facebook/http://somemaps/image1.jpg
I don't get why Facebook isn't just using my raw picture Url in the first place!? Grrrrr
Anyone else having problem posting images to facebook wall, where image is a realtime generated image from Bing Maps, or Google Static Maps API?
I was having a similar issue and after a long debugging session it was due to me not providing a link and name attribute along with the picture attribute. I was just sending in message and picture but I think Facebook changed the way you can post pictures in a post recently because this did work about a month ago when I was testing.... Make sure they are all included in your post to Facebook. To post a picture you have to post to /me/photos, can't just send in a link unless you want it displayed as a "Facebook Link". Hope that helps.