Anyone know the way to share the android application market link using facebook by sent request to Facebook friends.
If any giant helpful me a lot.
Thanks in advance.
Look at https://developers.facebook.com/docs/graph-api/reference/v2.2/user/feed page. In Publishing section click on Android SDK tab and you can see this snippet:
Bundle params = new Bundle();
params.putString("message", "This is a test message");
/* make the API call */
new Request(
session,
"/me/feed",
params,
HttpMethod.POST,
new Request.Callback() {
public void onCompleted(Response response) {
/* handle the result */
}
}
).executeAsync();
I think you can use "link" field (with combination of name, caption, description or message).
Bundle params = new Bundle();
params.putString("name", "Name of your app");
params.putString("message", "Your message");
params.putString("link", "https://play.google.com/store/apps/details?id=<your_package_name>");
And in addition you can link stories generated by your app with your app's Google Play listing. It's called "Deep Linking": https://developers.facebook.com/docs/applinks/android
Related
My Facebook app's Status and Review feedback suggests not to pre-fill text while posting on wall. But I can found the use of message param in the Facebook Graph API documentation Graph API Publishing section.
Bundle params = new Bundle();
params.putString("message", "This is a test message");
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/me/feed",
params,
HttpMethod.POST,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();
I have verified it and it works fine. Is it allowed as per updated Facebook policies ?
The message must be 100% user generated, so if you present an (EMPTY!) input field where the user can enter the message before you do the API call, it´s fine. Prefilling means that you prefill the message or the input field, which is not allowed.
https://developers.facebook.com/docs/apps/review/prefill
here is the facebook sample
Bundle params = new Bundle();
params.putString("source", "{image-data}");
/* make the API call */
new Request(
session,
"/me/photos",
params,
HttpMethod.POST,
new Request.Callback() {
public void onCompleted(Response response) {
/* handle the result */
}
}
).executeAsync();
what is {image-data}
I tried use byte[].toString, file.toString, path of file. not work.
so how to upload photo with this api?
facebook doc is wrong.
change
params.putString("source", "{image-data}");
to
params.putByteArray("source", "{image-data}");
If you want to post a photo, use one of the Request.newUploadPhotoRequest methods, it will set everything up for you.
See https://developers.facebook.com/docs/reference/android/current/class/Request/#newUploadPhotoRequest
Hello this is the first time I am integrating facebook in any of my android applications
I need to implement functionality to like a fp page/post and comment on fb page/post ,,,!!
i have downloaded the fb sdk for android and played around with it how ever i am still not clear as to what to i need to do and how to approach the requirement
What i need is when the user clicks a button in my app it automatically likes a fb post
and it submits text from edit text as a comment to as fb post ,,!!
Can some one tell how to go about this
To "like" a post:
Something like:
Facebook mFacebook = new Facebook();
mFacebook.request(THE_POST_ID + "/likes", parameters, "POST");
To "comment" on a post:
Bundle parameters = new Bundle();
parameters.putString("message", edtComment.getText().toString());
mFacebook.request(THE_POST_ID + "/comments", parameters, "POST");
To like a post
Request likeRequest = new Request(Session.getActiveSession(), postId + "/likes", null, HttpMethod.POST, new Request.Callback() {
#Override
public void onCompleted(Response response) {
this.like.setText("liked");
this.like.setEnabled(false);
CommentAdapter.this.like.setBackgroundResource(R.drawable.disabled_like);
this.getLikesCount();
}
});
Request.executeBatchAsync(likeRequest);
Now, I know that it's common question, but since "message" parameter is not valid, I wonder how to post just message to my facebook wall?
I use this:
public void postOnWall(Facebook mFacebook) {
try{
Bundle parameters = new Bundle();
parameters.putString("caption", "Caption");
parameters.putString("description", "Description");
mFacebook.dialog(this, "feed", params, new PostDialogListener());
}
catch(Exception e){}
}
I always get empty form without any title or content. I tried all params from facebook sdk docs but still no results.
UPD: when I say empty I mean this:
Why is the message parameter invalid? If you want to only post a message on your wall its should simply be just a matter of doing the following:
Bundle params = new Bundle();
params.putString("message", "test message on my wall");
mAsyncRunner.request("feed", params, "POST", new PostDialogListener(), null);
Please see below link of Stack overflow's answer for how to integrate facebook into your android application and if u have any query regarding that then tell me.
Post status on Facebook
i am doing a sample Facebook application in that i post a image file to a particular friend in my friends list, if any one having the solution...
Here is the code..i put the stream.publish method inside the request function..it works well..
protected void postToWall(String temp2) {
Bundle params = new Bundle();
params.putString("message", _messageInput.getText().toString()"some text Here);
params.putString("caption", "{*actor*} just posted a secret message.");
params.putString("description","A secret message is waiting for you. Click the link to decode it.");
params.putString("name", "A Secret Message For You");
params.putString("picture","http://www.kxminteractive.com/Content/images/app_logos/secretMessage.png");
params.putString("link", "http://www.kxminteractive.com/decrypt/");
**mAsyncRunner.request(((temp2 == null) ? "me" : temp2) + "/feed",
params, "POST", new WallPostRequestListener(),stream.publish);**
}