This is Social login library in which you can login through Facebook and Google
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.AqeelAaqi:EvolveLibrary:Tag'
}
where Tag is the version of the lib. You can find the latest version in the badge on top of the page
To login into some Facebook, you should call Facebook.
For facebook login you will need to add the following to your android manifest
<uses-permission android:name="android.permission.INTERNET" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
import com.evolve.evolvear.Facebook;
facebook = new Facebook(this);
facebook.login();
Also you should impliments EvolveLibrary listener for callback
implements Facebook.FacebookResponseListener
@Override
public void onFacebookResponseListener(JSONObject response, boolean error) {
Log.d("Response", String.valueOf(response));
}
Also you should redirect you onActivityResult() callback to EvolveLibrary
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
facebook.activityResult(requestCode, resultCode, data);
}
Register your app on Google Developer Account
Please view the Goolgle documentation if you face any issue related to dependency
- Add JSON file into app folder of the Project
implementation 'com.google.android.gms:play-services-auth:20.3.0'
plugins {
id 'com.android.application' version '7.2.2' apply false
id 'com.android.library' version '7.2.2' apply false
}
android.enableJetifier=true
To login into Google you should call EvolveLibrary.
import com.evolve.evolvear.Google;
google = new Google(this);
google.login();
Google.GoogleResponseListener
@Override
public void onGoogleResponseListener(JSONObject response, boolean error) {
Log.d("Response", String.valueOf(response));
}
Also you should redirect you onActivityResult() callback to EvolveLibrary
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == SocialLoginConstant.GOOGLE_REQUEST_CODE) {
google.activityResult(requestCode, resultCode, data);
}
}
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
[MIT]