Hello every i am working app where i have to send invitation of my app to my facebook friend.
My invitation successfully send but message is not showing to my friend whom i send the app request.
i follow this question which help in that but message is not showing to that user whom i send the app request.
here is my code:
Bundle parameters = new Bundle();
parameters.putString("to", fb2);
parameters.putString("message", "hello app ...");
Facebook mFacebook = new Facebook(APP_ID);
mFacebook.dialog(getParent(), "apprequests", parameters, new Facebook.DialogListener() {
#Override
public void onComplete(Bundle values) {
Toast.makeText(getParent(), "Invitation has been send", Toast.LENGTH_SHORT).show();
}
#Override
public void onCancel() {
}
#Override
public void onFacebookError(FacebookError e) {
}
#Override
public void onError(DialogError e) {
}
});
Related
I am working on an Android App , Here I am working on Facebook Login using QuickBlox SDK . I have implemented this using below code. I have visited many posts on stackoverflow but no luck .
Here is the reference code :
LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
#Override
public void onSuccess(LoginResult loginResult) {
AccessToken accessToken = loginResult.getAccessToken();
facebooklogin(accessToken);
}
#Override
public void onCancel() {
// App code
Toast.makeText(getApplicationContext(), "Cancel", Toast.LENGTH_SHORT).show();
}
#Override
public void onError(FacebookException exception) {
// App code
Toast.makeText(getApplicationContext(), "Error-Check Network Connection", Toast.LENGTH_SHORT).show();
}
});
public void facebooklogin(final AccessToken accessToken) {
QBAuth.createSession(new QBEntityCallbackImpl<QBSession>() {
#Override
public void onSuccess(QBSession session, Bundle params) {
String token = accessToken.getToken();
QBUsers.signInUsingSocialProvider(QBProvider.FACEBOOK, token, null, new QBEntityCallbackImpl<QBUser>() {
#Override
public void onSuccess(QBUser user, Bundle args) {
Toast.makeText(getApplicationContext(), "Success QB", Toast.LENGTH_SHORT).show();
}
#Override
public void onError(List<String> errors) {
Toast.makeText(getApplicationContext(), "onError QB", Toast.LENGTH_SHORT).show();
}
});
}
#Override
public void onError(List<String> errors) {
Toast.makeText(getApplicationContext(), "onError", Toast.LENGTH_SHORT).show();
}
});
}
What is happening here , when I login to facebook , then after successfull facebook login I get "OnError QB" toast from onError() method . Can anyone please tell me , what wrong I am doing here ?
By facebook default message post
#SuppressWarnings("deprecation")
public void postToWall() {
// post on user's wall.
facebook.dialog(this, "feed", new DialogListener() {
#Override
public void onFacebookError(FacebookError e) {
}
#Override
public void onError(DialogError e) {
}
#Override
public void onComplete(Bundle values) {
}
#Override
public void onCancel() {
}
});
}
we can share data but want to do the same thing with regular edit text and button,Is there any way to do this,please suggest me,thanku
this will help you.
Bundle parameters = new Bundle();
parameters.putString("message", "Test");
parameters.putString("description", "topic share");
facebook.request("me");
facebook.request("me/feed", parameters, "POST");
I have created a facebook event with my android coding and now I want to invite friends to it.
Below is my code to invite friends:
private void inviteFriends()
{
try
{
Bundle params = new Bundle();
params.putString("title", "invite friends");
params.putString("message", "come join us!");
facebook.dialog(this, "apprequests", params, new DialogListener() {
#Override
public void onComplete(Bundle values) {}
#Override
public void onFacebookError(FacebookError error) {}
#Override
public void onError(DialogError e) {}
#Override
public void onCancel() {}
public void onComplete(String response, Object state)
{
try
{
JSONObject eventResponse = new JSONObject(response);
//event_id = event.getString("id");
Log.i(TAG, "Event Response => "+eventResponse);
Log.w("myapp", friends);
//Toast.makeText(getApplicationContext(), "New Event Created!!", Toast.LENGTH_LONG).show();
}
catch (Exception e)
{
}
}
});
}
catch (Exception e)
{
}
}
The code works up to selecting friends, the title and message comes with the friend list. I can send the invitation but no notifications are sent to selected people.
Please tell me what needs to be done. Thank you in advance!
this image.
Have you turned on the App omn Facebbok Tab in your app developer setting like this.
If don't then it will not sent notification to your friends.
I am able to post facebook feed through Facebook Android SDK; however, I found that the feed dialog doesn't have privacy setting button, did I do anything wrong?
Bundle params = new Bundle();
params.putString("description", "This is description!");
params.putString("name", "appname");
params.putString("captions", "This is captions!");
params.putString("link", "http://www.google.com");
facebook.dialog(this, "feed", params,
new DialogListener() {
#Override
public void onComplete(Bundle values) {}
#Override
public void onFacebookError(FacebookError error) {}
#Override
public void onError(DialogError e) {}
#Override
public void onCancel() {}
}
);
You can configure privacy via params in facebook.dialog(this, "feed",params, ...) see here for details
I'm using this code to post on Facebook, but it does not work with the official Facebook app because it tries to send as a link. Is there any way around this?
Intent s = new Intent(android.content.Intent.ACTION_SEND);
s.setType("text/plain");
s.putExtra(Intent.EXTRA_SUBJECT, "Quote");
s.putExtra(Intent.EXTRA_TEXT, qoute);
startActivity(Intent.createChooser(s, "Quote"));
It's a bug in the official facebook app. I had to code my own activity to do it using the Facebook SDK for Android. See the code sample below.
public class FacebookActivity extends Activity implements DialogListener
{
private Facebook facebookClient;
private LinearLayout facebookButton;
private final String APP_API_ID = "XXXXXXXX";
#Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
facebookClient = new Facebook();
// replace APP_API_ID with your own
facebookClient.authorize(this, APP_API_ID,
new String[] {"publish_stream", "read_stream", "offline_access"}, this);
}
#Override
public void onComplete(Bundle values)
{
if (values.isEmpty())
{
//"skip" clicked ?
}
// if facebookClient.authorize(...) was successful, this runs
// this also runs after successful post
// after posting, "post_id" is added to the values bundle
// I use that to differentiate between a call from
// faceBook.authorize(...) and a call from a successful post
// is there a better way of doing this?
if (!values.containsKey("post_id"))
{
try
{
Bundle parameters = new Bundle();
parameters.putString("message", "YOUR TEXT TO SHARE GOES HERE");// the message to post to the wall
facebookClient.dialog(this, "stream.publish", parameters, this);// "stream.publish" is an API call
}
catch (Exception e)
{
// TODO: handle exception
System.out.println(e.getMessage());
}
}
}
#Override
public void onError(DialogError e)
{
return;
}
#Override
public void onFacebookError(FacebookError e)
{
return;
}
#Override
public void onCancel()
{
return;
}
}