Git Product home page Git Product logo

android-smart-login's Introduction

Android Arsenal

Image

What's in the box

  • The login framework for your app
  • Implementation of Facebook and Google login
  • Easy way to implement custom login and sign up

Setup

1. Include in your project

Using Gradle

The Android-Smart-Login library is pushed to jcenter, so you need to add the following dependency to your app's build.gradle.

compile 'codelight.studios:android-smart-login:1.2'

As a module

If you can't include it as gradle dependency, you can also download this GitHub repo and copy the library folder to your project.

2. Usage

First step in configuring the Smart Login Framework is to implement SmartLoginCallbacks in your Activity.

public interface SmartLoginCallbacks {
    void onLoginSuccess(SmartUser user);
    void onLoginFailure(SmartLoginException e);
    SmartUser doCustomLogin();
    SmartUser doCustomSignup();
}

Next step is to configure the SmartLoginConfig.

Example:

SmartLoginConfig config = new SmartLoginConfig(this /* Context */, this /* SmartLoginCallbacks */);
config.setFacebookAppId(getString(R.string.facebook_app_id));

This is the simplest way to configure the library to enable Custom login mode along with Facebook and Google login modes.

Next step is to override the onActivityResult of your Activity.

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    smartLogin.onActivityResult(requestCode, resultCode, data, config);
}

Final step is to call the login method when user clicks on the login button.

/* Facebook Login */
SmartLogin smartLogin = SmartLoginFactory.build(LoginType.Facebook);
smartLogin.login(config);

/* Google Login */
SmartLogin smartLogin = SmartLoginFactory.build(LoginType.Google);
smartLogin.login(config);

That's it!

Once the login succeeds, SmartUser object is returned in onLoginSuccess(SmartUser user).

For detailed usage and examples check the Project's Wiki

Included Libraries

The following third-party libraries were used in this framework.

  • Facebook SDK
  • Google Play Services - Auth
  • GSON library

Other Features

Get the current logged in user at anytime from your application by just calling UserSessionManager.getCurrentUser method.

SmartUser currentUser = UserSessionManager.getCurrentUser(context);
if(currentUser != null){
    //You have got what you need
}

Contribution

All contributions are welcome. Encounter any issue? Don't hesitate to open an issue

Convention: Master branch would be the development branch. So feel free to fork from the Master branch. Release branch will be merged with master branch after every major release.

Our other libraries

An easy and efficient way to get weather information into your app.

License

Copyright 2017 Codelight Studios

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

android-smart-login's People

Contributors

delphine-binoux avatar devyo12 avatar kalyandechiraju avatar

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.