Code Monkey home page Code Monkey logo

android-sdk's Introduction

LoginRadius Android SDK

Home Image

Introduction

LoginRadius is an Identity Management Platform that simplifies user registration while securing data. LoginRadius Platform simplifies and secures your user registration process, increases conversion with Social Login that combines 30 major social platforms, and offers a full solution with Traditional Customer Registration. You can gather a wealth of user profile data from Social Login or Traditional Customer Registration.

LoginRadius centralizes it all in one place, making it easy to manage and access. Easily integrate LoginRadius with all of your third-party applications, like MailChimp, Google Analytics, Livefyre, and many more, making it easy to utilize the data you are capturing.

LoginRadius helps businesses boost user engagement on their web/mobile platform, manage online identities, utilize social media for marketing, capture accurate consumer data, and get unique social insight into their customer base.

Please visit here for more information.

There are two projects in the library:

a. demo - This is the demo application.
b. androidSDK -This is the LoginRadius SDK.

Installing

LoginRadius is now using Gradle.

Use the following dependency in your project:

implementation 'com.loginradius.android:androidsdk:5.1.0'

LoginRadius SDK is now available as an AAR dependency. You can add it using File > New Module > Import .JAR/.AAR Package. Then, add it to your build.gradle:

compile project(':androidsdk-release')

Initialize SDK

Before using the SDK, you must initialize the SDK with the help of the following code:

LoginRadiusSDK.Initialize init = new LoginRadiusSDK.Initialize();

Credential Encryption (Optional)

LoginRadius provides an extra level of security for Api Credentials inside the SDK using key store encryption, this encryption will encrypt the Api Key & Site Name, to enable this encryption you need to pass true into setIsEncryption function.

init.setIsEncryption(true);

Note: For enabling encryption init.setIsEncryption(true) need to be added before initializing the API key and Site Name.


Initialize API credentials (Required)

Before using the SDK, you must initialize the Api credentials with the help of the following code

init.setApiKey("<your-api-key>");
init.setSiteName("<your-site-name>");

For step by step guide on getting Api Credentials from Login Radius Admin Console, please refer to this document

Referer Header (Optional)

The referer header is used to determine the registration source from which the user has created the account and is synced in the RegistrationSource field for the user profile. When initializing the SDK, you can optionally specify Referer Header.

init.setReferer("<Referer-Header-Value>");

Custom Header (Optional)

You can optionally specify Custom Header. This feature allows you to add the Custom header in an API request, you can add multiple headers using key, value pair.

Map<String,String> customHeader=new HashMap<String, String>();
customHeader.put("<Custom-Header-Name>", "<Custom-Header-Value>");
customHeader.put("<Custom-Header-Name1>", "<Custom-Header-Value1>");
init.setCustomHeader(customHeader);
       

Facebook Login

For Native Facebook Login Add the following meta data to your Android Manifest inside the application tag:


<meta-data
    android:name="com.facebook.sdk.ApplicationId"
    android:value="facebook_app_id" />
 <meta-data 
    android:name="com.facebook.sdk.ClientToken" 
    android:value="facebook_client_token"/>

Encryption of Sensitive information

LoginRadius provides key store encryption for sensitive information, you can leverage the following helper functions for encryption and decryption of sensitive information stored inside your project.

Note: These helper function require Android 6/Api Level 23 or higher,

Encryption

To encrypt the sensitive information using the helper function encryptData() please use the following code

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    String dataToBeEncrypted="<data-to-be-encrypted>";
    String result=LoginRadiusEncryptor.encryptData(dataToBeEncrypted);
    System.out.println(result);
}

Decryption

The encrypted data will be decrypted using the helper function decryptData() please use the following code to decrypt the data.

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
     String encryptedData="<encryptedData>";
     String result= LoginRadiusEncryptor.decryptData(encryptedData);
     System.out.println(result);
}

Build.VERSION.SDK_INT >= Build.VERSION_CODES.M indicates that the above helper function should only be called on the API level 23 or higher

android-sdk's People

Contributors

agarwal-sudhanshu avatar giriraj1200 avatar giriraj12000 avatar govindmalviya avatar indrasen715 avatar karl-loginradius avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

android-sdk's Issues

login with facebook crash with API31

Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
at android.app.ActivityThread.deliverResults(ActivityThread.java:5368)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:5407)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:67)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2253)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7870)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

LoginRadiusAuthManager is leaking GoogleNativeActivity

LoginRadiusAuthManager is leaking GoogleNativeActivity, because a lambda in GoogleNativeActivity is passed into a static field in LoginRadiusAuthManager.

LeakCanary trace:

 │ GC Root: Thread object
 │
 ├─ WV.mk instance
 │    Leaking: NO (PathClassLoader↓ is not leaking)
 │    Thread name: 'CleanupReference'
 │    ↓ Thread.contextClassLoader
 ├─ dalvik.system.PathClassLoader instance
 │    Leaking: NO (LoginRadiusAuthManager↓ is not leaking and A ClassLoader is never leaking)
 │    ↓ ClassLoader.runtimeInternalObjects
 ├─ java.lang.Object[] array
 │    Leaking: NO (LoginRadiusAuthManager↓ is not leaking)
 │    ↓ Object[4122]
 ├─ com.loginradius.androidsdk.helper.LoginRadiusAuthManager class
 │    Leaking: NO (a class is never leaking)
 │    ↓ static LoginRadiusAuthManager.asyncHandler
 │                                    ~~~~~~~~~~~~
 ├─ com.loginradius.androidsdk.activity.GoogleNativeActivity$1 instance
 │    Leaking: UNKNOWN
 │    Retaining 130.0 kB in 2246 objects
 │    Anonymous class implementing com.loginradius.androidsdk.handler.AsyncHandler
 │    this$0 instance of com.loginradius.androidsdk.activity.GoogleNativeActivity with mDestroyed = true
 │    ↓ GoogleNativeActivity$1.this$0
 │                             ~~~~~~
 ╰→ com.loginradius.androidsdk.activity.GoogleNativeActivity instance
 ​     Leaking: YES (ObjectWatcher was watching this because com.loginradius.androidsdk.activity.GoogleNativeActivity
 ​     received Activity#onDestroy() callback and Activity#mDestroyed is true)
 ​     Retaining 130.0 kB in 2245 objects
 ​     key = ab3eeedb-c14e-4363-aeb3-73543d89f968
 ​     watchDurationMillis = 7675
 ​     retainedDurationMillis = 2674
 ​     context instance of com.loginradius.androidsdk.activity.GoogleNativeActivity with mDestroyed = true
 ​     mApplication instance of com.mirror.news.MirrorApp
 ​     mBase instance of androidx.appcompat.view.ContextThemeWrapper

As a side note, the 5.0.0 Release Notes do not mention the change in the Maven group name (android to androidsdk), so it's not really easy to install. The installation section was also not updated with the new group name.

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.