Android post to facebook wall, stream.publish broken since few days - android

I have a lot of apps published using the FB android sdk
github.com/facebook/facebook-android-sdk
All my applications that use FB stopped working since few days.
This is necessarily a change or a bug from FB side, because nothing has changed in my applications, It worked for months.
The dialog that opens to post a message ("stream.publish") seems not use the param "message", the form opens but the text box is empty!
Bundle parameters = new Bundle();
parameters.putString("message", "test message");
mFacebook.dialog(Example.this, "stream.publish", parameters,new SampleDialogListener());
Using debug I saw the URL with the "message" param:
https://m.facebook.com/dialog/stream.publish?message=test+message&app_id=....
The text input in the webview is emtpy!
Somebody have an idea or a workaround to fix this issue?

Try "feed" instead of "stream.publish"

Had the same problem for the last few days. Looks like Facebook is deprecating the Stream API: http://developers.facebook.com/docs/reference/rest/stream.publish/, not sure if this has anything to do with that.
Anyway, switching to using the Graph API's 'feed' method worked for me.

Related

Facebook API exception "This link could not be posted."

I am using facebook sdk 3.6 for android. I am trying to share link to users fb wall through my app.
I have used
Bundle postParam = new Bundle();
postParam.putString("link","http://mylink.com/image/09324 324.jpg"
postParam.putString("caption","my caption");
… … …
Request request = new Request(session, "me/feed", postParam, HttpMethod.POST, reqCallback);
RequestAsyncTask reqTask = new RequestAsyncTask(request);
reqTask.execute();
The link contains space character.
I can visit that link from browser simply by replacing the space character by %20. But when i do the same using link.replaceAll(" ","%20");, i get Facebook api exception,
ErrorMessage = This link could not be posted.
ErrorCode = 1500
ErrorType= FacebookApiException
I supposed this as url encoding problem, but it is neither get solved using URLEncoder nor by replacing space by %20 by replaceAll method of String object.
There are no any non-printable characters in the string.
Note: The same link when copied from log cat output and added back to that bundle works fine.
Update: When i retried to post the same link (not log cat copied) from program, it get successfully posted.
What is the problem and how could it be solved?
Sometimes Facebook will block a link or domain from their blacklist. One way to test this is if you try to post directly onto Facebook with the same link.
Link below might be of help, they suggest you use https://safeweb.norton.com to if the link is safe or not and therefore blacklisted.
https://www.facebook.com/help/community/question/?id=541062392623556
hmmm maybe using
link.replaceAll("\\s","");
\s = Anything that is a space character (including space, tab characters etc)
as you can see here:
Answer
Hope it helps :)
Actually i have used facebook shareDialog and present user with the status dialog box where app can populate the link, picture,descriptionandmessage`(message is only populated on webview i.e. in device with no fb application installed) property and the user can edit/fill in the status and post on his on timeline.
This is more nicer way to post on somebody's wall because the user can see what he is posting.
Sorry to answer my own question so lately, though i have solved it already.

Facebook search implementation in android

I need to search facebook user by using his name or mail-id just like how it works in facebook search box. Any API's available for that.
Thanks in advance.
You will get a bunch of options for searching at this link here: https://developers.facebook.com/docs/reference/api/. On this page, you will need to scroll down a bit till you find the Searching heading.
I am personally, not aware of any provision to search using the email address.
I think you should take a look to the facebook developer documents talking about android and and the example provide in the SDK first
https://developers.facebook.com/docs/mobile/android/build/
It will help you to recognize how to use the facebook-android-sdk
Here's are the code
Bundle params = new Bundle();
params.putString("q", "Your Name");
params.putString("type", "user");//fix
String resp = fb.request("search", params, "GET");//call the request function of android sdk 2.X, ensure you have well setup the library and logged

Android Facebook Share Not Working

I have spent quite much time trying to implement Facebook share with no success. I have tried various implementations and read quite a few Q&As related to similar problems I had occurred.
I have as much as simple Facebook Example does. What I want is to set description or at least message of the feed dialog. This is what I have added to example's code:
Bundle parameters = new Bundle();
parameters.putString("caption", "1000vaikai Caption...");
parameters.putString("description", "This is a description"); // the message to post to the wall
parameters.putString("user_message_prompt", "This is message prompt");
parameters.putString("user_message", "MEEEESAGE");
mFacebook.dialog(Example.this, "feed", parameters,
new SampleDialogListener());
But it has no effect. There is nothing preset, just a plain feed dialog. Here it says dialog methods has key-value parameters but I can't find a list of them. As you can see, I tried using parameters from the feed URL but it doesn't work.
Anyone got it working properly?
EDIT
I hacked Facebook SDK and it seems to generate proper URL (https://m.facebook.com/dialog/feed + my parameters + ones taken from Facebook SDK itself). That means it DOES use same parameters as the ones listed in documentation about feed dialog page. But it still doesn't work. These parameters are being set:
user_message
redirect_uri
description
app_id
display
caption
access_token
user_message_prompt
Only app_id (I can see my app name), access_token (share actually works) and redirect_uri (it redirects back to mobile app) seem to have the effect
So I have figured out that you must provide either a link or picture. If not - it simply ignores all the over parameters.

I want to post a string msg on facebook's wall

I have my appId for facebook. Which type of configuration and auth should I require.
Now I want to post a String message on Facebook wall when some condition true. What should I do?
I am just giving you the first link i found on the search , take a look it, it has all the things you require...
http://blog.doityourselfandroid.com/2011/02/28/30-minute-guide-integrating-facebook-android-application/
Please go through below link . It might helps you a lot.
Facebook android sdk
you can also send message directly using the below code.
Bundle params = new Bundle();
params.putString("message", message);
mFacebook.request("me/feed", params, "POST");
you can create facebook object and using request method you can directly post to user wall. Before posting on wall you must have to login into facebook .
Checkout Facebook SDK for android
https://github.com/facebook/facebook-android-sdk
also Facebook Android Tutorial It will help you.
https://developers.facebook.com/docs/mobile/android/build/

Integrating the Like Button of Facebook in an android application

I am working on an application where I need to integrate the Like functionality of Facebook, other than Like I have completed all the features including Share, Upload, etc..
I am stuck in Like because I did,'t find anything for Like in the Facebook SDK I found from the Net on demand.
Can anybody please help me in this, any help or link will be greatly appreciated.
Thanks,
david
From what I understand, you are correct in that there is no Like functionality in the SDK.
It seems that the best way is to use a WebView with the standard Javascript code available from Facebook, however I think this way has it's own problems but looks like it can be accomplished...
See here and here.
If you have OBJECT_ID for the item you want to like, it shouldn't require anything else than sending an empty HTTP POST to http://graph.facebook.com/OBJECT_ID/likes .
Bundle params = new Bundle();
params.putString(Facebook.TOKEN, mFacebook.getAccessToken());
mFacebook.request(objectId + "/likes", params, "POST");
See Publishing in developer docs.

Categories

Resources