Code Monkey home page Code Monkey logo

fb-android-friend-dialog's Introduction

fb-android-friend-dialog

I made this dialog since the "normal" way of invoking the friend dialog end with an "Sorry, something went wrong" error. Recently, Facebook answered in a bug report that they were not going to fix this in a short or medium term (see this bug report https://developers.facebook.com/x/bugs/506955376009451/)

More info here : http://www.abewy.com/site/blog/2013/12/18/facebook-friend-dialog/

Usage

Assuming that you are logged in Facebook using the Facebook Android SDK

private void handleAddFriend()
{
  new FbFriendDialog(this, user.getUsername(), new FbFriendDialog.DialogListener() {

	  @Override
	  public void onFacebookError(FacebookError e)
	  {
		  Log.d("UserTimeline", "FbFriendDialog onFacebookError: " + e);
	  }

	  @Override
	  public void onError(DialogError e)
	  {
		  Log.d("UserTimeline", "FbFriendDialog onError: " + e);
	  }

	  @Override
	  public void onComplete(Bundle values)
	  {
		  if (values != null)
		  {
			  String result = values.getString("action");

			  if (result != null && result.equals("1"))
			  {
				  // friend request sent or confirmed
			  }
			  else if (result != null && result.equals("0"))
			  {
				  // friend request declined or canceled
			  }
		  }
	  }

	  @Override
	  public void onCancel()
	  {
		  Log.d("UserTimeline", "FbFriendDialog onCancel: ");
	  }
  }).show();
}

Required dependencies

Facebook Android SDK : https://github.com/facebook/facebook-android-sdk

License

fb-android-friend-dialog is available under the Beerware license.

If we meet some day, and you think this stuff is worth it, you can buy me a beer in return.

fb-android-friend-dialog's People

Contributors

jonathangerbaud avatar

Stargazers

Jacob Groß avatar Anton Krasov avatar

Watchers

James Cloos avatar  avatar

Forkers

longnguyencmg

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.