Code Monkey home page Code Monkey logo

android-simple-social-sharing's Introduction

! THIS PROJECT IS NO LONGER BEING MAINTAINED !

Simple Social Sharing for Android

This project aims to provide a reusable instrument for simple sharing with popular social networks (Facebook, Twiiter). Project uses other open source projects' code (actual on 25.02.2012):

Features

  • Simple API for Facebook and Twitter sharing (fast indroduction)
  • Simple API for event listening (authentication, posting, logging out)
  • Support only simple sharing (post message or image to Facebook, post status to Twitter)

Important: In your Twitter Developer Application Settings (https://dev.twitter.com/) you must fill "Callback URL" field with any URL (i.e. http://abc.de). It's behaviour by default.

There are two classes in SSS:

  • TwitterDialog
  • CallbackTwitterDialog

CallbackTwitterDialog is used by default and it works only when "Callback URL" is filled in your Twitter Application settings. You may not use callback URL. Then you should clear "Callback URL" field in app settings and replace all using CallbackTwitterDialog with TwitterDilaog (in TwitterFacade class).

Usage

Sharing API

Facebook

FacebookFacade facebook = new FacebookFacade(activity, FACEBOOK_APP_ID);
if (!facebook.isAuthorized()) {
	facebook.authorize();
}
facebook.publishMessage("This is great App!");
facebook.logout();

More powerful posting:

Map actions = new HashMap<String, String>();
actions.put("Android Simple Social Sharing", "https://github.com/nostra13");
facebook.publishMessage("Look at this great App!",
						"Use Android Simple Social Sharing in your project!",
						"https://github.com/nostra13/Android-Simple-Social-Sharing",
						"Also see other projects of nostra13 on GitHub!",
						"http://.......facebook-android-logo-1.jpg",
						actions);

Screenshot

Twitter

TwitterFacade twitter = new TwitterFacade(context, TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET);
if (!twitter.isAuthorized()) {
	twitter.authorize();
}
twitter.publishMessage("This is great app!");
twitter.logout();

Event listening API

Facebook

...
	@Override
	protected void onStart() {
		super.onStart();
		FacebookEvents.addAuthListener(authListener);
		FacebookEvents.addPostListener(postListener);
		FacebookEvents.addLogoutListener(logoutListener);
	}

	@Override
	protected void onStop() {
		super.onStop();
		FacebookEvents.removeAuthListener(authListener);
		FacebookEvents.removePostListener(postListener);
		FacebookEvents.removeLogoutListener(logoutListener);
	}

	private AuthListener authListener = new AuthListener() {
		@Override
		public void onAuthSucceed() {
			showToastOnUIThread("Facebook authentication is successful");
		}

		@Override
		public void onAuthFail(String error) {
			showToastOnUIThread("Error was occurred during Facebook authentication");
		}
	};

	private PostListener postListener = new PostListener() {
		@Override
		public void onPostPublishingFailed() {
			showToastOnUIThread("Post publishing was failed");
		}

		@Override
		public void onPostPublished() {
			showToastOnUIThread("Posted to Facebook successfully");
		}
	};

	private LogoutListener logoutListener = new LogoutListener() {
		@Override
		public void onLogoutComplete() {
			showToastOnUIThread("You are logged out");
		}
	};

	private void showToastOnUIThread(final String text) {
		runOnUiThread(new Runnable() {
			@Override
			public void run() {
				Toast.makeText(YourActivity.this, text, Toast.LENGTH_SHORT).show();
			}
		});
	}
...

Twitter

Like Facebook listening example but use TwitterEvents instead of FacebookEvents.

License

Licensed under the BSD 3-clause

android-simple-social-sharing's People

Contributors

alessioarsuffi avatar gauravsapiens avatar nostra13 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-simple-social-sharing's Issues

Library Project

The project does seem to have been uploaded correctly. The source is there, but the project is not. It would be helpful to a lot of people if the project was also uploaded, so we dont have to create it ourselves and import the source.

More social platforms?

Are you going to implement any other social platforms?
Like Google+?

I also have sources and demo for Hyves (dutch social platform).
Would you like to have a look at this also?

Unable to share with Facebook more things than simple message.

Trying to call the function
facebook.publishMessage("Look at this great App!",
"Use Android Simple Social Sharing in your project!",
"https://github.com/nostra13/Android-Simple-Social-Sharing",
"Also see other projects of nostra13 on GitHub!",
"http://.......facebook-android-logo-1.jpg",
actions);

causes the following exceptions:
W/Bundle(4031): Key picture expected byte[] but value was a java.lang.String. The default value was returned.
W/Bundle(4031): Attempt to cast generated internal exception:
W/Bundle(4031): java.lang.ClassCastException: java.lang.String cannot be cast to byte[]
...
W/Bundle(4031): Key description expected byte[] but value was a java.lang.String. The default value was returned.
W/Bundle(4031): Attempt to cast generated internal exception:
W/Bundle(4031): java.lang.ClassCastException: java.lang.String cannot be cast to byte[]
...
and more. Posting in that way doesn't work.

Tested on Android 2.2, 2.3.3 and 4.1.2.

Ugly webview

Hello,

library is awesome, but there is ugly webview no page not found, after completing twitter authorization. It shows only 2 seconds...Is there way to set that webview to visibility GONE?

Thanks

Couldn't post using twitter

I've been struggling using your your library since a long time.
I get a "Error was occurred during Twitter authentication".

Any ideas on where I could be wrong ?

Any plan for Facebook Android SDK 3.0?

I read your source code and see you're using the old Facebook Android SDK (2.0) - which will be be supported in this June.
So, do you have any plan to upgrade the Facebook SDK to 3.0?

Facebook sharing is not working with my App ID?

I know that this library is not being maintained. But I hope that any users can help me out.

I ran the sample App and it was working as expected. Then I changed the facebook App id to my App id. And now the App is sharing.

Why this is happening?

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.