/KingsLogin-android

Integrate your Android apps in Kotlin with KingsChat Platform.

Primary LanguageKotlin

KingsLogin Android

Apache 2.0 License Release

This library allows your android app to login using Kingschat.

Written in Kotlin 1.3.41

Supported Android API version 19 and higher

Installation Guide

Create your app in Kingschat Dashboard

If you don't know how to generate your Signature (SHA1) follow Developers Guide

Gradle implementation

  1. Add the JitPack repository to your root build.gradle:
repositories {
    maven { url "https://jitpack.io" }
}
  1. Add the dependency to your sub build.gradle:
dependencies {
    compile 'com.github.kingschat:KingsLogin-android:{lastest-version}'
}

App implementation

  1. Get your application Client ID from Kingschat Dashboard and add it to manifest file
<meta-data
    android:name="com.kingschat.sdk.ApplicationId"
    android:value="Your client ID" />
  1. Init KingsLogin library
KingsLogin.init(applicationContext)
  1. Use KingsLoginButton or create your custom button in layout
<com.newmedia.kingslogin.widget.KingsLoginButton
  android:id="@+id/button"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content" />
  1. In Activity register callbacks
KingsLoginManager.getInstance().registerCallback(callbackManager, kingsloginCallback)

and handle it in onActivityResult

 override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        if (callbackManager.onActivityResult(requestCode, resultCode, data))
        else
            super.onActivityResult(requestCode, resultCode, data)
    }
  1. Instead of KingsLogin you can request permissions directly
KingsLogin.requestPermissions(this, listOf("user"))

Sample

For more information about implementation check our sample app