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

Related tags

AndroidSocialNetworks
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:[email protected]') {
      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.
Issues
  • 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
  • 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:[email protected]')
    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
  • Facebook Session

    Facebook Session

    Hi,

    Is it possible to get the Session from facebook Login?

    Cheers,

    opened by quentin23soleil 9
  • fix Facebook share not working #24 issue

    fix Facebook share not working #24 issue

    This should fix #24 issue if facebook app setup correctly

    opened by gorbin 7
  • Facebook share not working

    Facebook share not working

    I press "post to facebook", application hangs on executing request and nothing else happens screenshot

    opened by invizorys 6
  • 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
  • AccessToken

    AccessToken

    Missing getAccessToken() method of SocialNetwork class. It would be great to have it for sending to backend.

    opened by npc-trj 6
  • [Improvement] Optional access to user e-mail

    [Improvement] Optional access to user e-mail

    Maybe we can have an option to retrieve the user e-mail if needed (and if available - Twitter don't give the user e-mail).

    opened by rafaeltoledo 5
  • Not call onLoginSuccess

    Not call onLoginSuccess

    Hello,

    very beautiful work.

    Im use it in depedencies 'com.github.androidsocialnetworks:library:[email protected]'

    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
  • 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
  • fix(Facebook Profile Picture): Set image URL to https

    fix(Facebook Profile Picture): Set image URL to https

    If http is used, the graph API image URL won't get redirected properly.

    opened by gottsohn 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
  • Facebook post not working

    Facebook post not working

    I've tested with the demo, it's the same

    opened by pierrexn 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
  • manifest errors

    manifest errors

    Hi: I have two errors in my MainActivity manifest with the classes APIDemosApplication.java and MainActivity.java. it says that com.github.androidsocialnetworks.apidemos.activity.APIDemosApplication.java doesn't exist and the same with the other class although they do exist. any solution???

    opened by nana992 0
  • onSocialNetworkManagerInitialized please return the instance

    onSocialNetworkManagerInitialized please return the instance

    manager.setOnInitializationCompleteListener(new SocialNetworkManager.OnInitializationCompleteListener() {
                @Override
                public void onSocialNetworkManagerInitialized() {
                    //here it would be nice to have the SocialNetworkManager instance
                }
            });
    
    opened by matantsu 0
  • making the login state app wide ?

    making the login state app wide ?

    i have integrated this library into my app , and it for now works great on google plus , i can call a function to login in my fragment and all is good.

    just one question , how can i acsess the state of the user from anywhere in the app ? (eg. isConnected() etc...)

    opened by matantsu 13
Releases(v0.3.3)
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 Jul 5, 2021
Easy social network authorization for Android. Supports Facebook, Twitter, Instagram, Google+, Vkontakte. Made by Stfalcon

SocialAuthHelper A library that helps to implement social network authorization (Facebook, Twitter, Instagram, GooglePlus, Vkontakte). Who we are Need

Stfalcon LLC 97 Jul 19, 2021
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.4k Jul 29, 2021
Tweet Lanes for Android

Tweet Lanes Tweet Lanes is a fully functional Twitter client, targeted at Android devices running API 14 and above. This project contains the full sou

Chris Lacy 777 Jun 28, 2021
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.4k Jul 29, 2021
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 322 Jul 26, 2021
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 176 Mar 21, 2021
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 108 Jun 10, 2021
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 20.6k Jul 30, 2021
PHPHub for Android

创造不息,交付不止 相关项目 PHPHub-iOS by @Aufree PHPHub-Server by @NauxLiu PHPHub-Android by @Kelvin and @Xiaoxiaoyu PHPHub-UI by @Summer and @Aufree PHPHub-Web b

Kelvin 964 Jul 16, 2021
GitPoint is one of the most feature-rich unofficial GitHub clients that is 100% free.

View repository and user information, control your notifications and even manage your issues and pull requests. Built with React Native, GitPoint is one of the most feature-rich unofficial GitHub clients that is 100% free.

GitPoint 4.5k Jul 30, 2021
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 87 Jul 22, 2021
WordPress for Android

WordPress for Android If you're just looking to install WordPress for Android, you can find it on Google Play. If you're a developer wanting to contri

WordPress Mobile 2.5k Jul 29, 2021
The ribot studio app for the Android Platform

Thank you for your interest in ribot’s development work. Unfortunately there are no current plans to make any changes to this project in the near futu

ribot 1.2k Jul 26, 2021