Library for easy work with Facebook, Twitter, LinkedIn and Google on Android

Overview

THIS PROJECT IS NO LONGER MAINTAINED, FEEL FREE TO FORK AND FIX IT FOR YOUR NEEDS

There is also an Android Library that is being maintained, CloudRail Android SDK that offers support for all the networks below as well as GitHub, Slack, Windows Live, and Slack.

Android Social Networks

Android Social Networks is library which makes working with social networks easier. If you sometime tried to work with social networks on android you should remember that this is a hell. You should read documentation for every social network, download SDK or use some libraries for OAuth and make http calls by yourself. This library should makes your life easier, it contains common interface for Twitter, LinkedIn, Facebook and Google Plus, just build SocialNetworkManager and configure your AndroidManiferst and you can login users, or post messages or photos or add / remove friends.

Library is still in development so more features will be added soon

Features

  • Login (Twitter, LinkedIn, Facebook, Google Plus)
  • Get person info (Twitter, LinkedIn, Facebook, Google Plus)
  • Post message (Twitter, LinkedIn, Facebook)
  • Post photo (Twitter, LinekdIn)
  • Check is user in your friends list (Twitter, LinkedIn)
  • Add to friends (Twitter, LinkedIn)
  • Remove from friends (Twitter)

Sample Application

Android app on Google Play

Getting started

First of all, you need to register you application, please check this links: Facebook, Twitter, LinkedIn, GooglePlus

Next you need to initialize mSocialNetworkManager. Build it with SocialNetworkManager.Builder and add to fragment manager.

    mSocialNetworkManager = (SocialNetworkManager) getFragmentManager().findFragmentByTag(SOCIAL_NETWORK_TAG);

    if (mSocialNetworkManager == null) {
        mSocialNetworkManager = SocialNetworkManager.Builder.from(getActivity())
                .twitter(<< TWITTER  API TOKEN  >>, << TWITTER  API SECRET  >>)
                .linkedIn(<< LINKED_IN  API TOKEN  >>, << LINKED_IN API TOKEN  >>, "r_basicprofile+rw_nus+r_network+w_messages")
                .facebook()
                .googlePlus()
                .build();
        getFragmentManager().beginTransaction().add(mSocialNetworkManager, SOCIAL_NETWORK_TAG).commit();
    }

Now you can execute requests, for example login request:

    mSocialNetworkManager.getTwitterSocialNetwork().requestLogin(new OnLoginCompleteListener() {
        @Override
        public void onLoginSuccess(int socialNetworkID) {

        }

        @Override
        public void onError(int socialNetworkID, String requestID, String errorMessage, Object data) {

        }
    });

Including in your project

Library is still in development, so for now it's only available in staging repo.

  compile('com.github.androidsocialnetworks:library:0.3.7@aar') {
      transitive = true
  }

Important

  • Library don't manage state, you need to do it yourself.
  • If you use Google Plus login, please add this in your Activity:
@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        /**
         * This is required only if you are using Google Plus, the issue is that there SDK
         * require Activity to launch Auth, so library can't receive onActivityResult in fragment
         */
        Fragment fragment = getSupportFragmentManager().findFragmentByTag(BaseDemoFragment.SOCIAL_NETWORK_TAG);
        if (fragment != null) {
            fragment.onActivityResult(requestCode, resultCode, data);
        }
    }

Dependencies

##Developed By

Anton Krasov - [email protected]


License

Android Social Networks is made available under the MIT license:

The MIT License (MIT)

Copyright (c) 2014 Anton Krasov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Comments
  • Multiple dex files define LinkedInCommunicationClient

    Multiple dex files define LinkedInCommunicationClient

    I have an Android project in Android Studio. I have included the libraries as shown below (I only need Linkedin)

    compile('com.github.androidsocialnetworks:library:0.3.2@aar')
    compile files('libs/linkedin-j-android.jar')
    compile files('libs/signpost-core-1.2.1.2.jar')
    compile files('libs/signpost-commonshttp4-1.2.1.2.jar')
    

    On build, I am getting the below error

    UNEXPECTED TOP-LEVEL EXCEPTION:
      com.android.dex.DexException: Multiple dex files define Lcom/google/code/linkedinapi/client/LinkedInCommunicationClient;
    

    I tried adding

    {
        transitive = true 
    }
    

    as suggested by you but that yielded a minimum SDK error. So I had that removed.

    opened by pocha 10
  • No SocialPerson nickname

    No SocialPerson nickname

    Hello, I'm trying to retrieve the socialPerson nickname, but it gives me cannot resolve variable!! I searched the api-demo and it looks it is used in the showprofile fragment, I copied the fragment and the same happened, Cannot resolve variable.

    so what's wrong??

    opened by falmanna 10
  • Calling .isConnected()

    Calling .isConnected()

    What's the best moment to call .isConnected()?

    Calling it inside onSocialNetworkManagerInitialized() always returns false.

    On the other hand, I find it hard to understand the correct flow. This is what I plan to do:

    • Initialize SocialNetworkManager
    • Check if user is connected to some social network with isConected() (where?).
    • If connected, perform some action (like opening a new activity). If not, the user can click the button and login with requestLogin()
    • Once requestLogin() has done, call requestCurrentPerson()to get profile info. Then save the email or whatever to a database (php/mysql in my case) and register the user.

    Is this reasoning ok to you?

    Anyway, the library is awesome.

    opened by devloe 6
  • Not call onLoginSuccess

    Not call onLoginSuccess

    Hello,

    very beautiful work.

    Im use it in depedencies 'com.github.androidsocialnetworks:library:0.3.7@aar'

    I created a class for managing the login button status and I have the code below. When i call requestLogin(); the "login" social access form appear and i login normaly. But when i finish authentication and social form disappear nothing happen.. never call onLoginSuccess, only onError work.. if i check social status after authentication its isConnected.

    i try with global listener, apply listener on requestLogin(listener) but nothing.. only onError called.

    private void makeAction() {
            if (this.mManager != null) {
                SocialNetwork social = this.mManager.getSocialNetwork(this.mSocialId);
                social.setOnLoginCompleteListener(new OnLoginCompleteListener() {
                    @Override
                    public void onLoginSuccess(int i) {
                        mStatus = CONNECTED;
                        setTextByStatus();
    
                        if (mExposedListener != null) {
                            mExposedListener.onLogin(mThis);
                        }
                    }
    
                    @Override
                    public void onError(int i, String s, String s2, Object o) {
                        mStatus = ERROR;
                        setTextByStatus();
                    }
                });
    
                switch (this.mStatus) {
                    case NOT_CONNECTED:
                    case ERROR:
                        this.mStatus = CONNECTING;
                        social.requestLogin();
                        break;
    
                    case CONNECTING:
                        this.mStatus = NOT_CONNECTED;
                        social.cancelLoginRequest();
                        break;
    
                    case CONNECTED:
                        this.mStatus = NOT_CONNECTED;
                        social.logout();
    
                        if (this.mExposedListener != null) {
                            this.mExposedListener.onLogout(this);
                        }
                        break;
                }
            }
        }
    

    Thanks for your help Sam

    opened by Paroca72 5
  • Can SocialNetworkManager.Builder have a #add method?

    Can SocialNetworkManager.Builder have a #add method?

    Hi!

    Thank you for this amazing lib. It helps a lot!

    I'd thinking. Is possible to Builder have a #add method to add more "social networks". For example, I want Instagram integration, but the actual lib doesn't have it. So, I can extend OAuthNetwork and implement the logic needed, but, where can I register this new network for manager?

    opened by geovanisouza92 5
  • AndroidSocialNetworks doesn't support Android Studio 0.8.1

    AndroidSocialNetworks doesn't support Android Studio 0.8.1

    Уважаемый автор обещал в ближайшее время обновить этот проект под свежую версию Android Studio и попросил меня напомнить тут ему об этом!


    Вот какая ситуация сейчас: Пытаюсь собрать проект в последней Android Studio 0.8.1 c вашей библиотекой

    По вашему описанию добавляю в build.gradle

    compile('com.github.androidsocialnetworks:library:0.3.2@aar') { transitive = true } или compile ('com.github.androidsocialnetworks:library:0.3.3')

    В итоге получаю такое сообщение Error:Module version com.android.support:support-v13:19.1.0 depends on libraries but is not a library itself (если поставить более старые версии support-v13, то будет ругаться также )

    opened by alexshr 3
  • Twitter getting OAuthAccessToken second time creates an Exception

    Twitter getting OAuthAccessToken second time creates an Exception

    With DEMO App, when logged in with Twitter, if the user clicks "Login with Twitter" again, the following exception occurs,

    05-07 02:20:12.829: E/AndroidRuntime(12737): Caused by: java.lang.IllegalStateException: Access token already available. 05-07 02:20:12.829: E/AndroidRuntime(12737): at twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:107) 05-07 02:20:12.829: E/AndroidRuntime(12737): at twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:98) 05-07 02:20:12.829: E/AndroidRuntime(12737): at twitter4j.TwitterBaseImpl.getOAuthRequestToken(TwitterBaseImpl.java:287) 05-07 02:20:12.829: E/AndroidRuntime(12737): at com.androidsocialnetworks.lib.impl.TwitterSocialNetwork$RequestLoginAsyncTask.doInBackground(TwitterSocialNetwork.java:246) 05-07 02:20:12.829: E/AndroidRuntime(12737): at com.androidsocialnetworks.lib.impl.TwitterSocialNetwork$RequestLoginAsyncTask.doInBackground(TwitterSocialNetwork.java:230) 05-07 02:20:12.829: E/AndroidRuntime(12737): at android.os.AsyncTask$2.call(AsyncTask.java:288) 05-07 02:20:12.829: E/AndroidRuntime(12737): at java.util.concurrent.FutureTask.run(FutureTask.java:237) 05-07 02:20:12.829: E/AndroidRuntime(12737): ... 4 more

    It is trying to fetch OAuthAccessTokan, when we already have it.

    opened by BharathMG 3
  • Modularity

    Modularity

    This library needs to be modular, we can just import the versions of implementations and uses an base class to provides the initial functions for the application. We don't need non used code in code of us...

    opened by ppamorim 2
  • error adding the library

    error adding the library

    i have just added the library to the build.gradle like this:

    compile('com.github.androidsocialnetworks:library:0.3.7@aar') {
            transitive = true
     }
    

    i have made no changes to the app besides that. when i try to run my app it now says:

    Error:Execution failed for task ':app:dexDebug'.
    > com.android.ide.common.internal.LoggedErrorException: Failed to run command:
        /root/Android/Sdk/build-tools/21.1.2/dx --dex --no-optimize --output /home/matan/AndroidStudioProjects/Stars/app/build/intermediates/dex/debug --input-list=/home/matan/AndroidStudioProjects/Stars/app/build/intermediates/tmp/dex/debug/inputList.txt
      Error Code:
        2
      Output:
        UNEXPECTED TOP-LEVEL EXCEPTION:
        com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
            at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502)
            at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277)
            at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491)
            at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168)
            at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
            at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
            at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
            at com.android.dx.command.dexer.Main.run(Main.java:246)
            at com.android.dx.command.dexer.Main.main(Main.java:215)
            at com.android.dx.command.Main.main(Main.java:106)
    
    opened by matantsu 2
  • Trouble with integrating services : project can't find a specific version of android support library

    Trouble with integrating services : project can't find a specific version of android support library

    Hi,

    I am trying to integrate the Google Play Services with my project. I have added the play services as a dependency to my build.gradle, but when I try to rebuild the project I get this error:

    Error:A problem occurred configuring project ':app'.
     > Could not resolve all dependencies for configuration ':app:_debugCompile'.
     > Could not find com.google.android.gms:play-services:4.3.23.
      Required by:
             myproject:app:unspecified > com.github.androidsocialnetworks:library:0.3.7
    

    In app : build.graddle

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 21
        buildToolsVersion "20.0.0"
    
        defaultConfig {
            applicationId "fr.istic.mmm.myplanner"
            minSdkVersion 19
            targetSdkVersion 20
            versionCode 1
            versionName "1.0"
        }
        buildTypes {
            release {
                runProguard false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'io.realm:realm-android:0.74.0'
        compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.1'
        compile 'com.squareup:android-times-square:1.4.1@aar'
        compile 'com.beardedhen:androidbootstrap:+'
        compile 'com.google.android.gms:play-services:4.3.23'
        compile('com.github.androidsocialnetworks:library:0.3.7@aar') {
            transitive = true
        }
    
    }
    

    Best regards,

    opened by Althas 2
  • How to declare gradle dependency?

    How to declare gradle dependency?

    Hi,

    Some newb question :) How can I declare the dependency for your library in my application. I tried compile 'com.github.androidsocialnetworks:0.3.4@aar' but it can't be found. Is it the correct name? Which repository should I add for gradle to find it?

    Thanks, Best, Thibaut

    opened by dthib 2
  • Fix broken headings in Markdown files

    Fix broken headings in Markdown files

    GitHub changed the way Markdown headings are parsed, so this change fixes it.

    See bryant1410/readmesfix for more information.

    Tackles bryant1410/readmesfix#1

    opened by bryant1410 0
  • Integration of Google+ isn't working in the same class where I integrated Facebook.

    Integration of Google+ isn't working in the same class where I integrated Facebook.

    I need to to integrate both Facebook and Google Plus in the same activity but I'm not getting success in it. I have tried both in individual projects and they work fine but when I add both projects together my app gets crashed. Even I have tried them with custom buttons too but they don't work either. Currently my Facebook part is working fine but I get error when I click on Google's button. I always get error in this line of Google+ code mConnectionResult.hasResolution()

    Anybody has solution of this? If yes then please provide to me.

    opened by anshul90 1
  • facebook part does not work with fb sdk 4+

    facebook part does not work with fb sdk 4+

    Hi,

    I know this project is not maintained longer. But still want to seek help, if it is possible, library FB portion can be fix for FB new version 4+ or lastest. library is very good, but new fb version removed many classes and changed functionality classes. if it is possible or any plan to upgrade project to higher fb version, it will be good, and usable for fb new version of sdk. thanks, for great library, really found very useful

    opened by satishkadyan 0
  • Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) always returns null

    Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) always returns null

    Login works, but I receive an error when I use ASN because the call Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) returns null.

    I have enabled the Google+ API but it still doesn't work!

    opened by thedumbtechguy 0
Releases(v0.3.3)
Owner
Anton Krasov
Anton Krasov
Login effortlessly with different social networks like Facebook, Twitter or Google Plus

EasyLogin Easy Login in your app with different social networks. Currently supported: Facebook Google Plus Twitter Global Configuration To be able to

Maksim 91 Nov 25, 2022
KTweet is a Kotlin Library that allows you to consume the Twitter API v2.

KTweet - A Kotlin Twitter Library KTweet is a library that allows you to use the Twitter API v2. Interested in Kotlin or KTweet? Join the Discord Setu

Thomas Carney 26 Dec 22, 2022
Material Design ready and feature rich Twitter/Mastodon/Fanfou app for Android 4.1+.

Twidere for Android Material Design ready and feature rich Twitter/Mastodon/Fanfou app for Android 4.1+. Enjoy Fediverse now! Twidere-Android is maint

Twidere Project 2.7k Jan 1, 2023
Share twitter url to this app, and you will be redirected.

twitter2nitter - redirect twitter to nitter Share twitter url to this app, and you will be redirected. Redirect works for: Open twitter url with twitt

null 14 Dec 20, 2022
Simple Twitter Client just for tweeting, written in Kotlin with reactive MVVM-like approach

Monotweety Simple Twitter Client just for tweeting. Monotweety is also available at F-Droid compatible repository called IzzyOnDroid F-Droid Repositor

Yasuhiro SHIMIZU 110 Nov 11, 2022
Yet another Twitter unofficial client for Lollipop.

Tweetin Yet another Twitter unofficial client. Just design for Lollipop now!!! Screenshot: How to use the source code? Just import the Tweetin folder

Matthew Lee 177 Aug 24, 2022
Status Stories = Snapchat stories, Instagram stories, Whatsapp Statuses, Facebook Messenger Stories.

StatusStories APK Link | Video Link | Up labs StatusStories helps you implement Photo Stories similar to Snapchat stories Instagram stories Whatsapp S

Rahul Janagouda 335 Jan 4, 2023
The Google I/O Android App

Google I/O Android App 2021 Update Due to global events, Google I/O 2020 was canceled and Google I/O 2021 is an online-only event, so the companion ap

Google 21.7k Jan 7, 2023
Android Stories library - Instagram-like android stories library that supports images from disk or from internet (url)

Android Stories Library Instagram like stories library for Android. Add it in your root build.gradle at the end of repositories: allprojects { reposi

Panagiotis Makris 3 Dec 20, 2022
📲 Android Application to track any user activity on Github built using the Github Developers API. Used Retrofit to fetch data and MVVM Architecture.

Github Visualizer ?? Android Application to track any user activity on Github built using the Github Developers Api. A sample application to demonstra

Dheeraj Kotwani 104 Dec 28, 2022
Youtube-dl for android

youtube-dl-android Android library wrapper for youtube-dl executable. Based on yausername's youtubedl-android but with ability to download binary file

Vikas 97 Dec 30, 2022
Twidere for Android

Twidere for Android Material Design ready and feature rich Twitter/Mastodon/Fanfou app for Android 4.1+. Enjoy Fediverse now! Twidere-Android is maint

Twidere Project 2.7k Dec 27, 2022
A Reddit client for Android

This is a Reddit client on Android written in Java. It does not have any ads and it features clean UI and smooth browsing experience.

null 2.6k Jan 9, 2023
An unofficial open source Reddit client for Android.

RedReader An unofficial, open source Android client for Reddit. Features Free and open-source Software - no ads/tracking Lightweight and fast Swipe po

null 1.4k Jan 7, 2023
Slide is an open sourced, ad free Reddit browser for Android

Slide Slide is an open source, ad free Reddit browser for Android. It is based around the Java Reddit API Wrapper. Slide is available on the Google Pl

Carlos Crane 1.7k Dec 27, 2022
Open-source alternative Instagram client on Android.

Instagram client; previously known as InstaGrabber.

Austin Huang 1.1k Jul 23, 2021
Kickstarter for Android. Bring new ideas to life, anywhere.

Welcome to Kickstarter's open source Android app! Come on in, take your shoes off, stay a while—explore how Kickstarter's native squad has built and c

Kickstarter 5.7k Jan 2, 2023
A light Sina Weibo client for Android

BlackLight 新浪微博客户端 请注意,当前BlackLight的开发已经被冻结,直到2016年高考后重启。 The development progress has been FROZEN till June 2016. 详细介绍以及Changelog请见Play商店。 https://pl

Paper Airplane Dev Team/纸飞机开发团队 884 Nov 22, 2022
Cnblogs Client for Android - Material Design

Cotable - Yet Another Cnblogs Client for Android Description Cotable = Code + Stable (The Paradise of Coder) The Android client of Cnblogs that named

Steve Lemuel 38 Feb 12, 2022