antonkrasov / androidsocialnetworks Goto Github PK
View Code? Open in Web Editor NEWLibrary for easy work with Facebook, Twitter, LinkedIn and Google on Android
Library for easy work with Facebook, Twitter, LinkedIn and Google on Android
public GooglePlusSocialNetwork getGooglePlusSocialNetwork() {
if (!mSocialNetworksMap.containsKey(GooglePlusSocialNetwork.ID)) {
throw new IllegalStateException(>>>"Facebook wasn't initialized..."<<< typo here , should be google );
}
return (GooglePlusSocialNetwork) mSocialNetworksMap.get(GooglePlusSocialNetwork.ID);
}
I've tested with the demo, it's the same
you can add instagram support ?
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
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.
Missing getAccessToken() method of SocialNetwork class. It would be great to have it for sending to backend.
If you press the cancel button on the Twitter login dialog, onLoginSuccess is still called (and not onError). For now this can be mitigated by calling isConnected() in onLoginSuccess...
After Signing into google + and restarting the app , the sign in button of google + becomes enabled and clicking on it throws an exception.
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
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:
SocialNetworkManager
isConected()
(where?).requestLogin()
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.
manager.setOnInitializationCompleteListener(new SocialNetworkManager.OnInitializationCompleteListener() {
@Override
public void onSocialNetworkManagerInitialized() {
//here it would be nice to have the SocialNetworkManager instance
}
});
Hello, its strange but when I add your lib as:
repositories {
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
compile('com.github.androidsocialnetworks:library:0.1.8-SNAPSHOT@aar') {
transitive = true
}
or as module to project I always get manifest merge error:
:app:processDebugManifest
Trying to merge incompatible /manifest/application/activity[@name=com.facebook.LoginActivity] element:
<activity
-- @android:name="com.facebook.LoginActivity">
--</activity>
--(end reached)
<activity
++ @android:name="com.facebook.LoginActivity"
++ @android:theme="@android:style/Theme.Translucent.NoTitleBar">
++</activity>
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merging failed. See console for more info.
What I'm doing wrong? as I understand its a bug in com.github.androidsocialnetworks:facebook:0.1.1-SNAPSHOT@aar
When I am trying to post on facebook.
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...)
Please add support for retrieving the Google+ Token. Example [here](http://developer.android.com/reference/com/google/android/gms/auth/GoogleAuthUtil.html#getToken%28android.content.Context, java.lang.String, java.lang.String%29)
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).
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!
Hi, I'm very new in android and I want to implement this for tests...
Can you make steps of how to implement this in Eclipse please?
Thanks,
Thiago.
Уважаемый автор обещал в ближайшее время обновить этот проект под свежую версию 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, то будет ругаться также )
I was wondering if we can make ASN one stop solution for integration with social networks.
How about Github integration into ASN too?
I would like to have your thoughts and any existing libraries that can speed up the implementation process.
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.
I cant seem to get email at all and birth_of_date = null, but i did put the required permissions ???
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...
The first time I use the twitter login with my application it works perfectly. If i continue using the same application/device works ok.
The problem is when i use another flavour/buildType of the application or use in another device.
After set my user and password the Twitter library enter in a infinite bucle of asking for my login and pass to give access for my application. The unique solution is go to twitter page and revoke the permission for my application.
My code bellow:
...
//Configuration
public void configureSocialLibrary() {
mSocialNetworkManager = SocialNetworkManager.Builder.from(this)
.twitter(BuildConfig.TWITTER_CONSUMER_KEY, BuildConfig.TWITTER_CONSUMER_SECRET)
.build();
getSupportFragmentManager().beginTransaction().add(mSocialNetworkManager, SOCIAL_TAG)
.commit();
}
...
//OnClick method to connect with twitter
@OnClick(R.id.login_btn_twitter)
public void clickLogin() {
if (mSocialNetworkManager.getTwitterSocialNetwork().isConnected()) {
connectWithMyStuff();
} else {
mSocialNetworkManager.getTwitterSocialNetwork().requestLogin(this);
}
}
//Twitter Login Callbacks
@Override
public void onLoginSuccess(int i) {
connectWithMyStuff();
}
@Override
public void onError(int i, String s, String s2, Object o) {
Toast.makeText(LoginActivity.this,
"Problem with the Twitter Login: " + s2,
Toast.LENGTH_LONG).show();
}
Should I do anything else?
Thank you
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)
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?
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???
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??
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,
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
@ChrisMCMine how can i get the expires after request login
Hi,
Is it possible to get the Session from facebook Login?
Cheers,
Hello everyone,
Again, as I was already telling Anton by email, congrats for the work done here, it's brilliant and really make our life easier for social networking implementation.
I'm writing here because I was wondering how to retrieve user's email.
I need it in the "login" feature of Social Networks, and only for Google+ & Facebook, and I was quite surprised it was not possible to access user's email from SocialPerson.email yet because I know Facebook Android SDK & Google+ Android API allow this 😃
So based on Anton suggestion, here's my issue ticket regarding this.
Also, here's how that could be done & implemented in Android Social Networks :
-- For Facebook
Line 166 of "FacebookSocialPerson.java" (in the "impl" folder of Social Networks) '''request.executeAsync();'''
Just before we could add
'''Bundle params = request.getParameters();
request.putString("fields", "email,name,<OTHER NECESSARY ?>");
request.setParameters(params);'''
Facebook's default approved item for an application to connect to FB's APIs include email, by default, again, so might be good for Facebook scopes already.
-- For Google+
Line 100 of "GooglePlusSocialNetwork.java" (in the "impl" folder of Social Networks)
'''Person person = mPlusClient.getCurrentPerson();'''
We could simply add after that :
socialPerson.email = mPlusClient.getAccountName();
For me, "getAccountName" possibly returns the email of the user (not always the case, but worth try it 👯 )
Maybe the scopes need to be extended compared to what Social Networks is asking. Here is what I used to ask as 'scopes' for Google+ sign in 👍
'''mPlusClient = new PlusClient.Builder(mContext, this, this).setScopes(Plus.SCOPE_PLUS_LOGIN.en(), Plus.SCOPE_PLUS_PROFILE.en()).build();'''
What do you think guys ? 😄
Hi,
thanks for the great library. I'm trying to install the repo into Android Studio using Gradle, but as soon as I add this to my build.gradle:
compile('com.github.androidsocialnetworks:library:0.3.2@aar') {
transitive = true
}
I get the error reported here:
http://stackoverflow.com/questions/24438170/manifest-merger-failed-uses-sdkminsdkversion-14
and because I don't have access to the build.gradle of the project when I use gradle, I can't apply any fix.
Suggestions?
I've verified that the Facebook picture URL is not working. Instead of user ID in the URL, it's setting null:
http://graph.facebook.com/null/picture?width=200&height=200
It's not working in the demo app too.
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.
When you use facebook sdk along with the parse sdk, both import the bolts library causing multiple dex issues. The fix is to use 'com.parse.bolts:bolts-android:+' in the facebook sdk instead of the jar.
Are there any form to use this library without the SupportLibrary? Using the native Fragments of the Android API 14+ ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.