This library allows your android app to login using Kingschat.
Written in Kotlin 1.3.41
Supported Android API version 19 and higher
Create your app in Kingschat Dashboard
If you don't know how to generate your Signature (SHA1)
follow Developers Guide
- Add the JitPack repository to your root build.gradle:
repositories {
maven { url "https://jitpack.io" }
}
- Add the dependency to your sub build.gradle:
dependencies {
compile 'com.github.kingschat:KingsLogin-android:{lastest-version}'
}
- 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" />
- Init KingsLogin library
KingsLogin.init(applicationContext)
- 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" />
- 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)
}
- Instead of KingsLogin you can request permissions directly
KingsLogin.requestPermissions(this, listOf("user"))
For more information about implementation check our sample app